Removed use of floats for nice savings.

This commit is contained in:
Dual Tachyon 2023-09-12 23:48:59 +01:00
parent bf430c9d98
commit 86b737ca4d
5 changed files with 11 additions and 10 deletions

View File

@ -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)

View File

@ -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

View File

@ -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:

View File

@ -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]);
}

View File

@ -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);