Removed floating point stuff

This commit is contained in:
OneOfEleven 2023-09-13 02:01:35 +01:00
parent 21d5d1ee15
commit 2f907f82f8
24 changed files with 146 additions and 117 deletions

View File

@ -34,19 +34,7 @@ To enable the custom option just uncomment the line by removing the starting '#'
* AM RX now allowed everywhere, although the radio really doesn't do AM, the adverts are a con !
* Finer RSSI bar steps
* Nicer/cleaner big numeric font than original QS big numeric font
*
* "MEM-CH" and "DEL-CH" menus now include channel name
* "STEP" menu, added 1.25kHz option, removed 5kHz option
* "TXP" menu, renamed to "TX-PWR"
* "SAVE" menu, renamed to "B-SAVE"
* "WX" menu, renamed to "CROS-B" ('WX' means weather here in the UK)
* "ABR" menu, renamed to "BAK-LT", extended times, includes always ON option
* "SCR" menu, renamed to "SCRAM"
* "MIC" menu, shows mic gain in dB's, includes max mic gain possible (+15.5dB)
* "VOL" menu, renamed to "BATVOL", added percentage level
* "AM" menu, renamed to "MODE", shows RX modulation mode
Menu renames are to try and reduce 'WTF does that mean ?'
* Various menu re-wordings - to try and reduce 'WTH does that mean ?'
# Compiler

View File

@ -136,7 +136,7 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
for (i = 0; i < 7; i++)
{
if (Frequency >= gLowerLimitFrequencyBandTable[i] && Frequency <= gUpperLimitFrequencyBandTable[i])
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i])
{
#ifndef DISABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;

View File

@ -440,11 +440,11 @@ void APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step)
{
uint32_t Frequency = pInfo->ConfigRX.Frequency + (Step * pInfo->StepFrequency);
if (Frequency < gLowerLimitFrequencyBandTable[pInfo->Band])
Frequency = FREQUENCY_FloorToStep(gUpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, gLowerLimitFrequencyBandTable[pInfo->Band]);
if (Frequency < LowerLimitFrequencyBandTable[pInfo->Band])
Frequency = FREQUENCY_FloorToStep(UpperLimitFrequencyBandTable[pInfo->Band], pInfo->StepFrequency, LowerLimitFrequencyBandTable[pInfo->Band]);
else
if (Frequency > gUpperLimitFrequencyBandTable[pInfo->Band])
Frequency = gLowerLimitFrequencyBandTable[pInfo->Band];
if (Frequency > UpperLimitFrequencyBandTable[pInfo->Band])
Frequency = LowerLimitFrequencyBandTable[pInfo->Band];
pInfo->ConfigRX.Frequency = Frequency;
}

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
#include <string.h>
#include "app/app.h"
#include "app/fm.h"
#include "app/generic.h"
@ -174,7 +176,7 @@ void GENERIC_Key_PTT(bool bKeyPressed)
else
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
sprintf(gDTMF_String, "%s", gDTMF_InputBox);
strcpy(gDTMF_String, gDTMF_InputBox);
gDTMF_PreviousIndex = gDTMF_InputIndex;
gDTMF_ReplyState = DTMF_REPLY_ANI;

View File

@ -104,7 +104,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
unsigned int i;
for (i = 0; i < 7; i++)
{
if (Frequency >= gLowerLimitFrequencyBandTable[i] && Frequency <= gUpperLimitFrequencyBandTable[i])
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i])
{
#ifndef DISABLE_VOICE
gAnotherVoiceID = (VOICE_ID_t)Key;
@ -123,7 +123,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
Frequency += 75;
gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, gLowerLimitFrequencyBandTable[gTxVfo->Band]);
gTxVfo->ConfigRX.Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
gRequestSaveChannel = 1;
return;

View File

@ -169,7 +169,7 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
unsigned int i;
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
SYSTEM_DelayMs(7);
SYSTEM_DelayMs(20);
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
for (i = 0; i < 8; i++)
@ -179,11 +179,12 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
else
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_1);
SYSTICK_DelayUs(1200);
SYSTICK_DelayUs(1000);
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
SYSTICK_DelayUs(1200);
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
VoiceID <<= 1;
SYSTICK_DelayUs(200);
}
}

27
board.c
View File

@ -39,6 +39,15 @@
#include "settings.h"
#include "sram-overlay.h"
static const uint32_t gDefaultFrequencyTable[] =
{
14502500,
14552500,
43477500,
43502500,
43697500
};
void BOARD_FLASH_Init(void)
{
FLASH_Init(FLASH_READ_MODE_1_CYCLE);
@ -389,7 +398,7 @@ void BOARD_EEPROM_Init(void)
gEeprom.KEY_2_LONG_PRESS_ACTION = (Data[4] < ACTION_OPT_LEN) ? Data[4] : ACTION_OPT_FM;
gEeprom.SCAN_RESUME_MODE = (Data[5] < 3) ? Data[5] : SCAN_RESUME_CO;
gEeprom.AUTO_KEYPAD_LOCK = (Data[6] < 2) ? Data[6] : false;
gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 3) ? Data[7] : POWER_ON_DISPLAY_MODE_MESSAGE;
gEeprom.POWER_ON_DISPLAY_MODE = (Data[7] < 3) ? Data[7] : POWER_ON_DISPLAY_MODE_VOLTAGE;
// 0E98..0E9F
EEPROM_ReadBuffer(0x0E98, Data, 8);
@ -478,9 +487,6 @@ void BOARD_EEPROM_Init(void)
EEPROM_ReadBuffer(0x0F40, Data, 8);
gSetting_F_LOCK = (Data[0] < 6) ? Data[0] : F_LOCK_OFF;
gUpperLimitFrequencyBandTable = UpperLimitFrequencyBandTable;
gLowerLimitFrequencyBandTable = LowerLimitFrequencyBandTable;
gSetting_350TX = (Data[1] < 2) ? Data[1] : false; // was true
gSetting_KILLED = (Data[2] < 2) ? Data[2] : false;
gSetting_200TX = (Data[3] < 2) ? Data[3] : false;
@ -587,4 +593,17 @@ void BOARD_FactoryReset(bool bIsAll)
EEPROM_WriteBuffer(i, Template);
}
}
if (bIsAll)
{
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + 5, 5, 43300000);
for (i = 0; i < 5; i++)
{
const uint32_t Frequency = gDefaultFrequencyTable[i];
gRxVfo->ConfigRX.Frequency = Frequency;
gRxVfo->ConfigTX.Frequency = Frequency;
gRxVfo->Band = FREQUENCY_GetBand(Frequency);
SETTINGS_SaveChannel(MR_CHANNEL_FIRST + i, 0, gRxVfo, 2);
}
}
}

BIN
firmware

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
misc.c
View File

@ -29,9 +29,6 @@ const uint32_t gDefaultAesKey[4] = {0x4AA5CC60, 0x0312CC5F, 0xFFD2DABB, 0x6BB
const uint8_t gMicGain_dB2[5] = {3, 8, 16, 24, 31};
const uint32_t *gUpperLimitFrequencyBandTable;
const uint32_t *gLowerLimitFrequencyBandTable;
bool gSetting_350TX;
bool gSetting_KILLED;
bool gSetting_200TX;

3
misc.h
View File

@ -84,9 +84,6 @@ extern const uint16_t gMin_bat_v;
extern const uint8_t gMicGain_dB2[5];
extern const uint32_t *gUpperLimitFrequencyBandTable;
extern const uint32_t *gLowerLimitFrequencyBandTable;
extern bool gSetting_350TX;
extern bool gSetting_KILLED;
extern bool gSetting_200TX;

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

18
radio.c
View File

@ -128,6 +128,12 @@ void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32
pInfo->pTX = &pInfo->ConfigTX;
pInfo->FREQUENCY_OF_DEVIATION = 1000000;
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
{
pInfo->AM_CHANNEL_MODE = true;
pInfo->IsAM = true;
}
RADIO_ConfigureSquelchAndOutputPower(pInfo);
}
@ -199,7 +205,7 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
Index = Channel - FREQ_CHANNEL_FIRST;
RADIO_InitInfo(pRadio, Channel, Index, gLowerLimitFrequencyBandTable[Index]);
RADIO_InitInfo(pRadio, Channel, Index, LowerLimitFrequencyBandTable[Index]);
return;
}
@ -342,14 +348,14 @@ void RADIO_ConfigureChannel(uint8_t VFO, uint32_t Arg)
Frequency = pRadio->ConfigRX.Frequency;
if (Frequency < gLowerLimitFrequencyBandTable[Band])
Frequency = gLowerLimitFrequencyBandTable[Band];
if (Frequency < LowerLimitFrequencyBandTable[Band])
Frequency = LowerLimitFrequencyBandTable[Band];
else
if (Frequency > gUpperLimitFrequencyBandTable[Band])
Frequency = gUpperLimitFrequencyBandTable[Band];
if (Frequency > UpperLimitFrequencyBandTable[Band])
Frequency = UpperLimitFrequencyBandTable[Band];
else
if (Channel >= FREQ_CHANNEL_FIRST)
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, gLowerLimitFrequencyBandTable[Band]);
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]);
pRadio->ConfigRX.Frequency = Frequency;

View File

@ -53,10 +53,10 @@ void UI_DisplayAircopy(void)
memset(String, 0, sizeof(String));
if (gAirCopyIsSendMode == 0)
sprintf(String, "RCV:%d E:%d", gAirCopyBlockNumber, gErrorsDuringAirCopy);
sprintf(String, "RCV:%u E:%u", gAirCopyBlockNumber, gErrorsDuringAirCopy);
else
if (gAirCopyIsSendMode == 1)
sprintf(String, "SND:%d", gAirCopyBlockNumber);
sprintf(String, "SND:%u", gAirCopyBlockNumber);
UI_PrintString(String, 2, 127, 4, 8);
ST7565_BlitFullScreen();

View File

@ -27,64 +27,80 @@
void UI_DisplayFM(void)
{
uint8_t i;
unsigned int i;
char String[16];
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
memset(String, 0, sizeof(String));
strcpy(String, "FM");
UI_PrintString(String, 0, 127, 0, 12);
memset(String, 0, sizeof(String));
if (gAskToSave) {
memset(String, 0, sizeof(String));
if (gAskToSave)
{
strcpy(String, "SAVE?");
} else if (gAskToDelete) {
}
else
if (gAskToDelete)
{
strcpy(String, "DEL?");
} else {
if (gFM_ScanState == FM_SCAN_OFF) {
if (!gEeprom.FM_IsMrMode) {
for (i = 0; i < 20; i++) {
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i]) {
sprintf(String, "VFO(CH%02d)", i + 1);
}
else
{
if (gFM_ScanState == FM_SCAN_OFF)
{
if (!gEeprom.FM_IsMrMode)
{
for (i = 0; i < 20; i++)
{
if (gEeprom.FM_FrequencyPlaying == gFM_Channels[i])
{
sprintf(String, "VFO(CH%02u)", i + 1);
break;
}
}
if (i == 20) {
if (i == 20)
strcpy(String, "VFO");
}
} else {
sprintf(String, "MR(CH%02d)", gEeprom.FM_SelectedChannel + 1);
else
sprintf(String, "MR(CH%02u)", gEeprom.FM_SelectedChannel + 1);
}
} else {
if (!gFM_AutoScan) {
else
{
if (!gFM_AutoScan)
strcpy(String, "M-SCAN");
} else {
sprintf(String, "A-SCAN(%d)", gFM_ChannelPosition + 1);
else
sprintf(String, "A-SCAN(%u)", gFM_ChannelPosition + 1);
}
}
}
UI_PrintString(String, 0, 127, 2, 10);
memset(String, 0, sizeof(String));
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex)) {
memset(String, 0, sizeof(String));
if (gAskToSave || (gEeprom.FM_IsMrMode && gInputBoxIndex))
{
UI_GenerateChannelString(String, gFM_ChannelPosition);
} else if (!gAskToDelete) {
if (gInputBoxIndex == 0) {
}
else
if (!gAskToDelete)
{
if (gInputBoxIndex == 0)
{
NUMBER_ToDigits(gEeprom.FM_FrequencyPlaying * 10000, String);
UI_DisplayFrequency(String, 23, 4, false, true);
} else {
UI_DisplayFrequency(gInputBox, 23, 4, true, false);
}
else
UI_DisplayFrequency(gInputBox, 23, 4, true, false);
ST7565_BlitFullScreen();
return;
} else {
sprintf(String, "CH-%02d", gEeprom.FM_SelectedChannel + 1);
}
else
{
sprintf(String, "CH-%02u", gEeprom.FM_SelectedChannel + 1);
}
UI_PrintString(String, 0, 127, 4, 10);
ST7565_BlitFullScreen();
}

View File

@ -32,7 +32,7 @@ void UI_GenerateChannelString(char *pString, const uint8_t Channel)
if (gInputBoxIndex == 0)
{
sprintf(pString, "CH-%02d", Channel + 1);
sprintf(pString, "CH-%02u", Channel + 1);
return;
}
@ -54,12 +54,12 @@ void UI_GenerateChannelStringEx(char *pString, const bool bShowPrefix, const uin
}
if (bShowPrefix)
sprintf(pString, "CH-%03d", ChannelNumber + 1);
sprintf(pString, "CH-%03u", ChannelNumber + 1);
else
if (ChannelNumber == 0xFF)
strcpy(pString, "NULL");
else
sprintf(pString, "%03d", ChannelNumber + 1);
sprintf(pString, "%03u", ChannelNumber + 1);
}
void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Line, uint8_t Width)

View File

@ -240,7 +240,7 @@ void UI_DisplayMain(void)
strcpy(String, "ALARM");
break;
case VFO_STATE_VOLTAGE_HIGH:
sprintf(String, "VOLT HIGH");
strcpy(String, "VOLT HIGH");
//Width = 8;
break;
}
@ -290,13 +290,13 @@ void UI_DisplayMain(void)
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1, true);
#else
// show the frequency in the main font
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
sprintf(String, "%03u.%05u", frequency_Hz / 100000, frequency_Hz % 100000);
UI_PrintString(String, 31, 112, Line, 8);
#endif
break;
case MDF_CHANNEL: // show the channel number
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, Line, 8);
frequency_Hz = 0;
break;
@ -304,7 +304,7 @@ void UI_DisplayMain(void)
case MDF_NAME: // show the channel name
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // no channel name, show the channel number instead
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintString(String, 31, 112, Line, 8);
}
else
@ -317,7 +317,7 @@ void UI_DisplayMain(void)
case MDF_NAME_FREQ: // show the channel name and frequency
if (gEeprom.VfoInfo[vfo_num].Name[0] == 0 || gEeprom.VfoInfo[vfo_num].Name[0] == 0xFF)
{ // no channel name, show channel number instead
sprintf(String, "CH-%03d", gEeprom.ScreenChannel[vfo_num] + 1);
sprintf(String, "CH-%03u", gEeprom.ScreenChannel[vfo_num] + 1);
UI_PrintStringSmall(gEeprom.VfoInfo[vfo_num].Name, 31 + 8, 0, Line);
}
else
@ -332,7 +332,7 @@ void UI_DisplayMain(void)
NUMBER_ToDigits(frequency_Hz, String); // 8 digits
UI_DisplayFrequencySmall(String, 31 + 8, Line + 1, false);
#else
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
sprintf(String, "%03u.%05u", frequency_Hz / 100000, frequency_Hz % 100000);
UI_PrintStringSmall(String, 31 + 8, 0, Line + 1);
#endif
@ -351,7 +351,7 @@ void UI_DisplayMain(void)
UI_DisplaySmallDigits(2, String + 6, 112, Line + 1, true);
#else
// show the frequency in the main font
sprintf(String, "%9.5f", frequency_Hz * 0.00001);
sprintf(String, "%03u.%05u", frequency_Hz / 100000, frequency_Hz % 100000);
UI_PrintString(String, 38, 112, Line, 8);
#endif
}

View File

@ -39,8 +39,8 @@ static const char MenuList[][7] =
"RxCTCS", // was "R_CTCS"
"TxDCS", // was "T_DCS"
"TxCTCS", // was "T_CTCS"
"SFTDir",
"Offset",
"TxDir", // was "SFT_D"
"TxOffs", // was "OFFSET"
"W/N",
"Scram", // was "SCR"
"BusyCL", // was "BCL"
@ -48,15 +48,15 @@ static const char MenuList[][7] =
"BatSav", // was "SAVE"
"VOX",
"BackLt", // was "ABR"
"Dual-W", // was "TDR"
"CrossB", // was "WX"
"DualRx", // was "TDR"
"TxVFO", // was "WX"
"Beep",
"TxTOut", // was "TOT"
#ifndef DISABLE_VOICE
"Voice",
#endif
"SC-Rev",
"MDF",
"ChDisp", // was "MDF"
"KeyLoc", // was "AUTOLk"
"S-Add1",
"S-Add2",
@ -80,7 +80,7 @@ static const char MenuList[][7] =
"PTT-ID",
"D-DCD",
"D-List",
"PonMsg",
"POnMsg",
"Roger",
"BatVol", // was "VOL"
"Mode", // was "AM"
@ -303,20 +303,18 @@ void UI_DisplayMenu(void)
switch (gMenuCursor)
{
case MENU_SQL:
sprintf(String, "%d", gSubMenuSelection);
sprintf(String, "%u", gSubMenuSelection);
break;
case MENU_MIC:
{ // display the mic gain in actual dB rather than just an index number
const uint8_t mic = gMicGain_dB2[gSubMenuSelection];
//EEPROM_ReadBuffer(0x1F80 + gSubMenuSelection, &mic, 1);
//sprintf(String, "%d %.1fdB", gSubMenuSelection, mic * 0.5);
sprintf(String, "%+.1fdB", mic * 0.5);
sprintf(String, "+%u.%01udB", mic / 2, mic % 2);
}
break;
case MENU_STEP:
sprintf(String, "%.2fKHz", gSubMenu_Step[gSubMenuSelection] * 0.01);
sprintf(String, "%u.%02uKHz", gSubMenu_Step[gSubMenuSelection] / 100, gSubMenu_Step[gSubMenuSelection] % 100);
break;
case MENU_TXP:
@ -339,7 +337,7 @@ void UI_DisplayMenu(void)
if (gSubMenuSelection == 0)
strcpy(String, "OFF");
else
sprintf(String, "%.1fHz", CTCSS_Options[gSubMenuSelection - 1] * 0.1);
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
break;
case MENU_SFT_D:
@ -349,7 +347,7 @@ void UI_DisplayMenu(void)
case MENU_OFFSET:
if (!gIsInSubMenu || gInputBoxIndex == 0)
{
sprintf(String, "%.5f", gSubMenuSelection * 1e-05);
sprintf(String, "%u.%05u", gSubMenuSelection / 100000, gSubMenuSelection % 100000);
break;
}
@ -375,7 +373,7 @@ void UI_DisplayMenu(void)
if (gSubMenuSelection == 0)
strcpy(String, "OFF");
else
sprintf(String, "%d", gSubMenuSelection);
sprintf(String, "%u", gSubMenuSelection);
break;
case MENU_ABR:
@ -384,7 +382,7 @@ void UI_DisplayMenu(void)
strcpy(String, "OFF");
else
if (gSubMenuSelection < 5)
sprintf(String, "%d sec", gSubMenuSelection * 10);
sprintf(String, "%u sec", gSubMenuSelection * 10);
else
strcpy(String, "ON");
#else
@ -449,7 +447,7 @@ void UI_DisplayMenu(void)
if (gSubMenuSelection == 0)
strcpy(String, "OFF");
else
sprintf(String, "%dmin", gSubMenuSelection);
sprintf(String, "%umin", gSubMenuSelection);
break;
#ifndef DISABLE_VOICE
@ -470,11 +468,11 @@ void UI_DisplayMenu(void)
if (gSubMenuSelection == 0)
strcpy(String, "OFF");
else
sprintf(String, "%d*100ms", gSubMenuSelection);
sprintf(String, "%u*100ms", gSubMenuSelection);
break;
case MENU_S_LIST:
sprintf(String, "LIST%d", gSubMenuSelection);
sprintf(String, "LIST%u", gSubMenuSelection);
break;
#ifndef DISABLE_ALARM
@ -500,11 +498,11 @@ void UI_DisplayMenu(void)
break;
case MENU_D_HOLD:
sprintf(String, "%ds", gSubMenuSelection);
sprintf(String, "%us", gSubMenuSelection);
break;
case MENU_D_PRE:
sprintf(String, "%d*10ms", gSubMenuSelection);
sprintf(String, "%u*10ms", gSubMenuSelection);
break;
case MENU_PTT_ID:
@ -528,7 +526,7 @@ void UI_DisplayMenu(void)
break;
case MENU_VOL:
sprintf(String, "%.2fV", gBatteryVoltageAverage * 0.01); // argh, floating point :(
sprintf(String, "%u.%02uV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
break;
case MENU_RESET:
@ -642,7 +640,7 @@ void UI_DisplayMenu(void)
i = gMenuCursor - MENU_SLIST1;
if (gSubMenuSelection == 0xFF)
sprintf(String, "NULL");
strcpy(String, "NULL");
else
UI_GenerateChannelStringEx(String, true, (uint8_t)gSubMenuSelection);
@ -656,13 +654,13 @@ void UI_DisplayMenu(void)
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH1[i]))
{
sprintf(String, "PRI1:%d", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
sprintf(String, "PRI1:%u", gEeprom.SCANLIST_PRIORITY_CH1[i] + 1);
UI_PrintString(String, 50, 127, 2, 8);
}
if (IS_MR_CHANNEL(gEeprom.SCANLIST_PRIORITY_CH2[i]))
{
sprintf(String, "PRI2:%d", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
sprintf(String, "PRI2:%u", gEeprom.SCANLIST_PRIORITY_CH2[i] + 1);
UI_PrintString(String, 50, 127, 4, 8);
}
}

View File

@ -34,17 +34,17 @@ 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:%u.%05u", gScanFrequency / 100000, gScanFrequency % 100000);
else
sprintf(String, "FREQ:**.*****");
strcpy(String, "FREQ:**.*****");
UI_PrintString(String, 2, 0, 1, 8);
memset(String, 0, sizeof(String));
if (gScanCssState < SCAN_CSS_STATE_FOUND || !gScanUseCssResult)
sprintf(String, "CTC:******");
strcpy(String, "CTC:******");
else
if (gScanCssResultType == CODE_TYPE_CONTINUOUS_TONE)
sprintf(String, "CTC:%.1fHz", CTCSS_Options[gScanCssResultCode] * 0.1);
sprintf(String, "CTC:%u.%uHz", CTCSS_Options[gScanCssResultCode] / 10, CTCSS_Options[gScanCssResultCode] % 10);
else
sprintf(String, "DCS:D%03oN", DCS_Options[gScanCssResultCode]);
UI_PrintString(String, 2, 0, 3, 8);

View File

@ -49,9 +49,10 @@ void UI_DisplayWelcome(void)
(gBatteryVoltageAverage > gMax_bat_v) ? gMax_bat_v :
gBatteryVoltageAverage;
sprintf(WelcomeString0, "VOLTAGE");
sprintf(WelcomeString1, "%.2fV %u%%",
gBatteryVoltageAverage * 0.01, // argh, floating point :(
strcpy(WelcomeString0, "VOLTAGE");
sprintf(WelcomeString1, "%u.%02uV %u%%",
gBatteryVoltageAverage / 100,
gBatteryVoltageAverage % 100,
(100 * (volts - gMin_bat_v)) / (gMax_bat_v - gMin_bat_v));
}
else

View File

@ -1,6 +1,8 @@
#ifdef GIT_HASH
const char Version[] = "OEFW-" GIT_HASH;
const char UART_Version[45] = "UV-K5 Firmware, Open Edition, OEFW-"GIT_HASH"\r\n";
#else
const char Version[] = "OEFW-230912";
const char Version[] = "OEFW-230913";
const char UART_Version[45] = "UV-K5 Firmware, Open Edition, OEFW-230913\r\n";
#endif

View File

@ -18,6 +18,7 @@
#define VERSION_H
extern const char Version[];
extern const char UART_Version[45];
#endif

View File

@ -13,7 +13,7 @@ del /S /Q *.o >nul 2>nul
del /S /Q *.d >nul 2>nul
::python -m pip install --upgrade pip crcmod
fw-pack.py firmware.bin 230912 firmware.packed.bin
fw-pack.py firmware.bin 230913 firmware.packed.bin
::arm-none-eabi-size firmware