diff --git a/Makefile b/Makefile index b365122..6527aec 100644 --- a/Makefile +++ b/Makefile @@ -176,6 +176,7 @@ ifeq ($(ENABLE_LTO), 1) CFLAGS += -flto=2 endif +CFLAGS += -Wpadded CFLAGS += -DPRINTF_INCLUDE_CONFIG_H CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\" diff --git a/app/action.c b/app/action.c index 0e3ef9e..729e34f 100644 --- a/app/action.c +++ b/app/action.c @@ -184,10 +184,16 @@ void ACTION_Scan(bool bRestart) if (gScanState != SCAN_OFF) { - SCANNER_Stop(); + #if 1 + // keep scanning but toggle between scan lists + gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) & 1u; + gUpdateStatus = true; + #else + SCANNER_Stop(); - #ifdef ENABLE_VOICE - gAnotherVoiceID = VOICE_ID_SCANNING_STOP; + #ifdef ENABLE_VOICE + gAnotherVoiceID = VOICE_ID_SCANNING_STOP; + #endif #endif } else @@ -200,7 +206,7 @@ void ACTION_Scan(bool bRestart) #endif // clear the other vfo's rssi level (to hide the antenna symbol) - gVFO_RSSI_bar_level[gEeprom.RX_CHANNEL == 0] = 0; + gVFO_RSSI_bar_level[(gEeprom.RX_CHANNEL + 1) & 1u] = 0; // let the user see DW is not active gDualWatchActive = false; @@ -210,16 +216,20 @@ void ACTION_Scan(bool bRestart) } else if (!bRestart) - { // scanning - + { // keep scanning but toggle between scan lists + gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) & 1u; + gUpdateStatus = true; + } + else + { // stop scanning gMonitor = false; - + SCANNER_Stop(); - + #ifdef ENABLE_VOICE gAnotherVoiceID = VOICE_ID_SCANNING_STOP; #endif - + gRequestDisplayScreen = DISPLAY_MAIN; } } diff --git a/app/main.c b/app/main.c index b0a31c4..dbe2c37 100644 --- a/app/main.c +++ b/app/main.c @@ -660,6 +660,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld) return; ACTION_Scan(false); + return; } diff --git a/bitmaps.c b/bitmaps.c index 790c6f0..9bc4252 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -281,24 +281,54 @@ const uint8_t BITMAP_TDR2[12] = 0b00110001 }; #endif - -const uint8_t BITMAP_SC[12] = -{ // "SC" - 0b00000000, - 0b01000110, - 0b01001001, - 0b01001001, - 0b01001001, - 0b00110001, - - 0b00000000, - 0b00111110, +/* +const uint8_t BITMAP_SC1[8] = +{ // "I" 0b01000001, 0b01000001, + 0b01111111, + 0b01111111, + 0b01111111, 0b01000001, - 0b00100010 + 0b01000001, + 0b00000000 }; +const uint8_t BITMAP_SC2[8] = +{ // "II" + 0b01000001, + 0b01111111, + 0b01111111, + 0b01000001, + 0b01111111, + 0b01111111, + 0b01000001, + 0b00000000 +}; +*/ +/* +const uint8_t BITMAP_SC1[7] = +{ // "1" + 0b01000000, + 0b01000000, + 0b01000110, + 0b01111111, + 0b01000000, + 0b01000000, + 0b00000000 +}; + +const uint8_t BITMAP_SC2[7] = +{ // "2" + 0b01000010, + 0b01100001, + 0b01010001, + 0b01001001, + 0b01001001, + 0b01000110, + 0b00000000 +}; +*/ const uint8_t BITMAP_Antenna[5] = { 0b00000011, @@ -385,17 +415,7 @@ const uint8_t BITMAP_VFO_NotDefault[8] = 0b00010100, 0b00001000 }; -/* -const uint8_t BITMAP_ScanList[6] = -{ // diamond symbol - 0b00001000, - 0b00011100, - 0b00111110, - 0b00111110, - 0b00011100, - 0b00001000 -}; -*/ + const uint8_t BITMAP_ScanList1[6] = { // 'I' symbol 0b00000000, diff --git a/bitmaps.h b/bitmaps.h index b73c516..ab0d979 100644 --- a/bitmaps.h +++ b/bitmaps.h @@ -46,7 +46,10 @@ extern const uint8_t BITMAP_TDR2[12]; extern const uint8_t BITMAP_NOAA[12]; #endif -extern const uint8_t BITMAP_SC[12]; +//extern const uint8_t BITMAP_SC1[8]; +//extern const uint8_t BITMAP_SC2[8]; +//extern const uint8_t BITMAP_SC1[7]; +//extern const uint8_t BITMAP_SC2[7]; extern const uint8_t BITMAP_Antenna[5]; extern const uint8_t BITMAP_AntennaLevel1[3]; @@ -61,7 +64,6 @@ extern const uint8_t BITMAP_MARKER[8]; extern const uint8_t BITMAP_VFO_Default[8]; extern const uint8_t BITMAP_VFO_NotDefault[8]; -//extern const uint8_t BITMAP_ScanList[6]; extern const uint8_t BITMAP_ScanList1[6]; extern const uint8_t BITMAP_ScanList2[6]; diff --git a/driver/adc.h b/driver/adc.h index b3c8b80..cd5edc2 100644 --- a/driver/adc.h +++ b/driver/adc.h @@ -42,8 +42,10 @@ enum ADC_CH_MASK { typedef enum ADC_CH_MASK ADC_CH_MASK; typedef struct { - uint8_t CLK_SEL; + uint16_t EXTTRIG_SEL; + uint16_t IE_CHx_EOC; ADC_CH_MASK CH_SEL; + uint8_t CLK_SEL; uint8_t AVG; uint8_t CONT; uint8_t MEM_MODE; @@ -51,13 +53,12 @@ typedef struct { uint8_t SMPL_SETUP; uint8_t SMPL_WIN; uint8_t ADC_TRIG; - uint16_t EXTTRIG_SEL; - bool CALIB_OFFSET_VALID; - bool CALIB_KD_VALID; uint8_t DMA_EN; - uint16_t IE_CHx_EOC; uint8_t IE_FIFO_HFULL; uint8_t IE_FIFO_FULL; + bool CALIB_OFFSET_VALID; + bool CALIB_KD_VALID; + uint8_t _pad[1]; } ADC_Config_t; uint8_t ADC_GetChannelNumber(ADC_CH_MASK Mask); diff --git a/settings.h b/settings.h index d3795e9..7370389 100644 --- a/settings.h +++ b/settings.h @@ -127,7 +127,15 @@ typedef struct { uint8_t field7_0xa; uint8_t field8_0xb; - uint32_t POWER_ON_PASSWORD; + #ifdef ENABLE_FMRADIO + uint16_t FM_SelectedFrequency; + uint8_t FM_SelectedChannel; + bool FM_IsMrMode; + uint16_t FM_FrequencyPlaying; + uint16_t FM_LowerLimit; + uint16_t FM_UpperLimit; + #endif + uint8_t SQUELCH_LEVEL; uint8_t TX_TIMEOUT_TIMER; bool KEY_LOCK; @@ -152,25 +160,10 @@ typedef struct { uint8_t field29_0x26; uint8_t field30_0x27; - - uint16_t VOX1_THRESHOLD; - uint16_t VOX0_THRESHOLD; - - #ifdef ENABLE_FMRADIO - uint16_t FM_SelectedFrequency; - uint8_t FM_SelectedChannel; - bool FM_IsMrMode; - uint16_t FM_FrequencyPlaying; - #endif uint8_t field37_0x32; uint8_t field38_0x33; - #ifdef ENABLE_FMRADIO - uint16_t FM_LowerLimit; - uint16_t FM_UpperLimit; - #endif - bool AUTO_KEYPAD_LOCK; #if defined(ENABLE_ALARM) || defined(ENABLE_TX1750) ALARM_Mode_t ALARM_MODE; @@ -216,11 +209,16 @@ typedef struct { uint8_t VOLUME_GAIN; uint8_t DAC_GAIN; + VFO_Info_t VfoInfo[2]; + uint32_t POWER_ON_PASSWORD; + uint16_t VOX1_THRESHOLD; + uint16_t VOX0_THRESHOLD; + uint8_t field77_0x95; uint8_t field78_0x96; uint8_t field79_0x97; - VFO_Info_t VfoInfo[2]; + uint8_t _pad[1]; } EEPROM_Config_t; extern EEPROM_Config_t gEeprom; diff --git a/ui/status.c b/ui/status.c index 4fafd6a..b1e94bc 100644 --- a/ui/status.c +++ b/ui/status.c @@ -96,10 +96,17 @@ void UI_DisplayStatus(const bool test_display) // SCAN indicator if (gScanState != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display) { - memmove(line + x, BITMAP_SC, sizeof(BITMAP_SC)); - x1 = x + sizeof(BITMAP_SC); + if (gEeprom.SCAN_LIST_DEFAULT == 0) +// memmove(line + x, BITMAP_SC1, sizeof(BITMAP_SC1)); + UI_PrintStringSmallBuffer("1", line + x); + else +// memmove(line + x, BITMAP_SC2, sizeof(BITMAP_SC2)); + UI_PrintStringSmallBuffer("2", line + x); +// x1 = x + sizeof(BITMAP_SC1); + x1 = x + 7; } - x += sizeof(BITMAP_SC); +// x += sizeof(BITMAP_SC1); + x += 7; // font character width #ifdef ENABLE_VOICE // VOICE indicator @@ -210,23 +217,37 @@ void UI_DisplayStatus(const bool test_display) #ifndef ENABLE_REVERSE_BAT_SYMBOL line += sizeof(BITMAP_BatteryLevel1); - if (gBatteryDisplayLevel >= 2) - memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 3) - memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 4) - memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 5) - memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + { + const int8_t pos[] = {-4, -7, -10, 13}; + for (unsigned int i = 0; i < ARRAY_SIZE(pos); i++) + if (gBatteryDisplayLevel >= (2 + i)) + memmove(line + pos[i], BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + +/* switch (gBatteryDisplayLevel) + { + default: + case 5: memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + case 4: memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + case 3: memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + case 2: memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + } +*/ } #else - if (gBatteryDisplayLevel >= 2) - memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 3) - memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 4) - memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); - if (gBatteryDisplayLevel >= 5) - memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + { + const int8_t pos[] = {3, 6, 9, 12}; + for (unsigned int i = 0; i < ARRAY_SIZE(pos); i++) + if (gBatteryDisplayLevel >= (2 + i)) + memmove(line + pos[i], BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); +/* + switch (gBatteryDisplayLevel) + { + default: + case 5: memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + case 4: memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + case 3: memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + case 2: memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel)); + } +*/ } #endif } else