Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigating float precision differences #3817

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lfrfid/protocols/protocol_fdx_b.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static bool protocol_fdx_b_get_temp(const uint8_t* data, float* temp) {
bool ex_temperature_present = (ex_calc_parity == ex_parity) && !(extended & 0xe00);

if(ex_temperature_present) {
float temperature_f = 74 + ex_temperature * 0.2;
float temperature_f = 74 + ex_temperature * 0.2f;
*temp = temperature_f;
return true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions lib/music_worker/music_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int32_t music_worker_thread_callback(void* context) {

float note_from_a4 = (float)note_block->semitone - NOTE_C4_SEMITONE;
float frequency = NOTE_C4 * powf(TWO_POW_TWELTH_ROOT, note_from_a4);
float duration = 60.0 * furi_kernel_get_tick_frequency() * 4 / instance->bpm /
float duration = 60.0f * furi_kernel_get_tick_frequency() * 4 / instance->bpm /
note_block->duration;
uint32_t dots = note_block->dots;
while(dots > 0) {
Expand All @@ -80,7 +80,7 @@ static int32_t music_worker_thread_callback(void* context) {
furi_hal_speaker_stop();
furi_hal_speaker_start(frequency, volume);
while(instance->should_work && furi_get_tick() < next_tick) {
volume *= 0.9945679;
volume *= 0.9945679f;
furi_hal_speaker_set_volume(volume);
furi_delay_ms(2);
}
Expand Down
2 changes: 1 addition & 1 deletion site_scons/cc.scons
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ENV.AppendUnique(
"-Wdouble-promotion",
"-fdata-sections",
"-ffunction-sections",
"-fsingle-precision-constant",
# "-fsingle-precision-constant",
"-fno-math-errno",
# Generates .su files with stack usage information
# "-fstack-usage",
Expand Down
2 changes: 1 addition & 1 deletion targets/f7/ble_glue/extra_beacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define TAG "BleExtraBeacon"

#define GAP_MS_TO_SCAN_INTERVAL(x) ((uint16_t)((x) / 0.625))
#define GAP_MS_TO_SCAN_INTERVAL(x) ((uint16_t)((x) / 0.625f))

// Also used as an indicator of whether the beacon had ever been configured
// AN5289: 4.7, we need at least 25ms + advertisement, which is 30 ms
Expand Down
2 changes: 1 addition & 1 deletion targets/f7/furi_hal/furi_hal_bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ float furi_hal_bt_get_rssi(void) {
} else {
val = agc * 6.0f - 127.0f;
while(rssi > 30) {
val += 6.0;
val += 6.0f;
rssi >>= 1;
}
val += (float)((417 * rssi + 18080) >> 10);
Expand Down
2 changes: 1 addition & 1 deletion targets/f7/furi_hal/furi_hal_infrared.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle) {
infrared_tim_tx.buffer[1].polarity = malloc(alloc_size_polarity);

infrared_tim_tx.stop_semaphore = furi_semaphore_alloc(1, 0);
infrared_tim_tx.cycle_duration = 1000000.0 / freq;
infrared_tim_tx.cycle_duration = 1000000.0f / freq;
infrared_tim_tx.tx_timing_rest_duration = 0;

furi_hal_infrared_tx_fill_buffer(0, INFRARED_POLARITY_SHIFT);
Expand Down
Loading