diff --git a/driver/bk4819.c b/driver/bk4819.c index 70f8a9be..75906547 100644 --- a/driver/bk4819.c +++ b/driver/bk4819.c @@ -456,7 +456,7 @@ void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch) | BK4819_REG_30_ENABLE_TX_DSP); ; - BK4819_WriteRegister(BK4819_REG_71, (uint16_t)(Frequency * 10.32444)); + BK4819_WriteRegister(BK4819_REG_71, (uint16_t)((Frequency * 1032444) / 100000)); } void BK4819_EnterTxMute(void) @@ -694,7 +694,7 @@ void BK4819_TransmitTone(bool bLocalLoopback, uint32_t Frequency) BK4819_WriteRegister(BK4819_REG_70, 0 | BK4819_REG_70_MASK_ENABLE_TONE1 | (96U << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)); - BK4819_WriteRegister(BK4819_REG_71, (uint16_t)(Frequency * 10.32444)); + BK4819_WriteRegister(BK4819_REG_71, (uint16_t)((Frequency * 1032444) / 100000)); if (bLocalLoopback) { BK4819_SetAF(BK4819_AF_BEEP); } else { @@ -946,7 +946,7 @@ void BK4819_GetVoxAmp(uint16_t *pResult) void BK4819_SetScrambleFrequencyControlWord(uint32_t Frequency) { - BK4819_WriteRegister(BK4819_REG_71, (uint16_t)(Frequency * 10.32444)); + BK4819_WriteRegister(BK4819_REG_71, (uint16_t)((Frequency * 1032444) / 100000)); } void BK4819_PlayDTMFEx(bool bLocalLoopback, char Code) diff --git a/printf_config.h b/printf_config.h index 2518a264..3e4070f4 100644 --- a/printf_config.h +++ b/printf_config.h @@ -1,3 +1,4 @@ #define PRINTF_DISABLE_SUPPORT_LONG_LONG #define PRINTF_DISABLE_SUPPORT_EXPONENTIAL #define PRINTF_DISABLE_SUPPORT_PTRDIFF_T +#define PRINTF_DISABLE_SUPPORT_FLOAT diff --git a/ui/menu.c b/ui/menu.c index 508aee6f..0f9566d3 100644 --- a/ui/menu.c +++ b/ui/menu.c @@ -216,7 +216,7 @@ void UI_DisplayMenu(void) break; case MENU_STEP: - sprintf(String, "%.2fKHz", gSubMenu_Step[gSubMenuSelection] * 0.01); + sprintf(String, "%d.%02dKHz", gSubMenu_Step[gSubMenuSelection] / 100, gSubMenu_Step[gSubMenuSelection] % 100); break; case MENU_TXP: @@ -239,7 +239,7 @@ void UI_DisplayMenu(void) if (gSubMenuSelection == 0) { strcpy(String, "OFF"); } else { - sprintf(String, "%.1fHz", CTCSS_Options[gSubMenuSelection - 1] * 0.1); + sprintf(String, "%d.%dHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10); } break; @@ -249,7 +249,7 @@ void UI_DisplayMenu(void) case MENU_OFFSET: if (!gIsInSubMenu || gInputBoxIndex == 0) { - sprintf(String, "%.5f", gSubMenuSelection * 1e-05); + sprintf(String, "%d.%05d", gSubMenuSelection / 100000, gSubMenuSelection % 100000); break; } for (i = 0; i < 3; i++) { @@ -412,7 +412,7 @@ void UI_DisplayMenu(void) break; case MENU_VOL: - sprintf(String, "%.2fV", gBatteryVoltageAverage * 0.01); + sprintf(String, "%d.%02dV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100); break; case MENU_RESET: diff --git a/ui/scanner.c b/ui/scanner.c index 2d6ec2e7..e93ca5fb 100644 --- a/ui/scanner.c +++ b/ui/scanner.c @@ -34,7 +34,7 @@ void UI_DisplayScanner(void) memset(String, 0, sizeof(String)); if (gScanSingleFrequency || (gScanCssState != SCAN_CSS_STATE_OFF && gScanCssState != SCAN_CSS_STATE_FAILED)) { - sprintf(String, "FREQ:%.5f", gScanFrequency * 1e-05); + sprintf(String, "FREQ:%d.%05d", gScanFrequency / 100000, gScanFrequency % 100000); } else { sprintf(String, "FREQ:**.*****"); } @@ -44,7 +44,7 @@ void UI_DisplayScanner(void) if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult) { sprintf(String, "CTC:******"); } else if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE) { - sprintf(String, "CTC:%.1fHz", CTCSS_Options[gScanCssResultCode] * 0.1); + sprintf(String, "CTC:%d.%dHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10); } else { sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]); } diff --git a/ui/welcome.c b/ui/welcome.c index 5e2c3225..d495cdbb 100644 --- a/ui/welcome.c +++ b/ui/welcome.c @@ -39,7 +39,7 @@ void UI_DisplayWelcome(void) memset(WelcomeString1, 0, sizeof(WelcomeString1)); if (gEeprom.POWER_ON_DISPLAY_MODE == POWER_ON_DISPLAY_MODE_VOLTAGE) { sprintf(WelcomeString0, "VOLTAGE"); - sprintf(WelcomeString1, "%.2fV", gBatteryVoltageAverage * 0.01); + sprintf(WelcomeString1, "%d.%02dV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100); } else { EEPROM_ReadBuffer(0x0EB0, WelcomeString0, 16); EEPROM_ReadBuffer(0x0EC0, WelcomeString1, 16);