Added seperate setting for 12/24h clock mode

This commit is contained in:
Sjef Verhoeven PE5PVB
2025-01-14 11:48:09 +01:00
parent 9a3bf8a5f9
commit d4f2a1a16f
6 changed files with 54 additions and 7 deletions
+6 -2
View File
@@ -73,6 +73,7 @@ bool BWreset;
bool bwtouchtune; bool bwtouchtune;
bool BWtune; bool BWtune;
bool change; bool change;
bool clockampm;
bool compressedold; bool compressedold;
bool direction; bool direction;
bool dropout; bool dropout;
@@ -189,7 +190,7 @@ byte amgain;
byte freqoldcount; byte freqoldcount;
byte HighCutLevel; byte HighCutLevel;
byte HighCutOffset; byte HighCutOffset;
byte items[10] = {10, static_cast<byte>(dynamicspi ? 10 : 9), 7, 10, 10, 10, 9, 8, 10, 9}; byte items[10] = {10, static_cast<byte>(dynamicspi ? 10 : 9), 7, 10, 10, 10, 9, 9, 10, 9};
byte iMSEQ; byte iMSEQ;
byte iMSset; byte iMSset;
byte language; byte language;
@@ -586,6 +587,7 @@ void setup() {
NTPoffset = EEPROM.readByte(EE_BYTE_NTPOFFSET); NTPoffset = EEPROM.readByte(EE_BYTE_NTPOFFSET);
autolog = EEPROM.readByte(EE_BYTE_AUTOLOG); autolog = EEPROM.readByte(EE_BYTE_AUTOLOG);
autoDST = EEPROM.readByte(EE_BYTE_AUTODST); autoDST = EEPROM.readByte(EE_BYTE_AUTODST);
clockampm = EEPROM.readByte(EE_BYTE_CLOCKAMPM);
if (spispeed == SPI_SPEED_DEFAULT) { if (spispeed == SPI_SPEED_DEFAULT) {
tft.setSPISpeed(SPI_FREQUENCY / 1000000); tft.setSPISpeed(SPI_FREQUENCY / 1000000);
@@ -4568,6 +4570,7 @@ void DefaultSettings() {
EEPROM.writeByte(EE_BYTE_NTPOFFSET, 1); EEPROM.writeByte(EE_BYTE_NTPOFFSET, 1);
EEPROM.writeByte(EE_BYTE_AUTOLOG, 1); EEPROM.writeByte(EE_BYTE_AUTOLOG, 1);
EEPROM.writeByte(EE_BYTE_AUTODST, 1); EEPROM.writeByte(EE_BYTE_AUTODST, 1);
EEPROM.writeByte(EE_BYTE_CLOCKAMPM, 0);
#ifdef DEEPELEC_DP_66X #ifdef DEEPELEC_DP_66X
EEPROM.writeByte(EE_BYTE_ROTARYMODE, 1); EEPROM.writeByte(EE_BYTE_ROTARYMODE, 1);
@@ -4820,6 +4823,7 @@ void endMenu() {
EEPROM.writeByte(EE_BYTE_NTPOFFSET, NTPoffset); EEPROM.writeByte(EE_BYTE_NTPOFFSET, NTPoffset);
EEPROM.writeByte(EE_BYTE_AUTOLOG, autolog); EEPROM.writeByte(EE_BYTE_AUTOLOG, autolog);
EEPROM.writeByte(EE_BYTE_AUTODST, autoDST); EEPROM.writeByte(EE_BYTE_AUTODST, autoDST);
EEPROM.writeByte(EE_BYTE_CLOCKAMPM, clockampm);
EEPROM.commit(); EEPROM.commit();
if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false; if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false;
Serial.end(); Serial.end();
@@ -5684,7 +5688,7 @@ String getCurrentDateTime() {
// Buffer for formatted date-time string // Buffer for formatted date-time string
char buf[20]; char buf[20];
if (radio.rds.region == 1) { if (clockampm) {
// USA format: MM/DD/YYYY, HH:MM AM/PM // USA format: MM/DD/YYYY, HH:MM AM/PM
strftime(buf, sizeof(buf), "%m/%d/%Y", &timeInfo); // Format as MM/DD/YYYY strftime(buf, sizeof(buf), "%m/%d/%Y", &timeInfo); // Format as MM/DD/YYYY
+5 -4
View File
@@ -225,9 +225,9 @@
#define EE_CHECKBYTE_VALUE 10 // 0 ~ 255,add new entry, change for new value #define EE_CHECKBYTE_VALUE 10 // 0 ~ 255,add new entry, change for new value
#define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped! #define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped!
#ifdef HAS_AIR_BAND #ifdef HAS_AIR_BAND
#define EE_TOTAL_CNT 2283 // Total occupied eeprom bytes #define EE_TOTAL_CNT 2284 // Total occupied eeprom bytes
#else #else
#define EE_TOTAL_CNT 2278 // Total occupied eeprom bytes #define EE_TOTAL_CNT 2279 // Total occupied eeprom bytes
#endif #endif
#define EE_PRESETS_BAND_START 0 // 99 * 1 byte #define EE_PRESETS_BAND_START 0 // 99 * 1 byte
@@ -348,9 +348,10 @@
#define EE_BYTE_NTPOFFSET 2275 #define EE_BYTE_NTPOFFSET 2275
#define EE_BYTE_AUTOLOG 2276 #define EE_BYTE_AUTOLOG 2276
#define EE_BYTE_AUTODST 2277 #define EE_BYTE_AUTODST 2277
#define EE_BYTE_CLOCKAMPM 2278
#ifdef HAS_AIR_BAND #ifdef HAS_AIR_BAND
#define EE_BYTE_AIRSTEPSIZE 2278 #define EE_BYTE_AIRSTEPSIZE 2279
#define EE_UINT16_FREQUENCY_AIR 2279 #define EE_UINT16_FREQUENCY_AIR 2280
#endif #endif
// End of EEPROM index defines // End of EEPROM index defines
+40
View File
@@ -1504,6 +1504,16 @@ void ShowOneLine(byte position, byte item, bool selected) {
FullLineSprite.drawString(String(amscansens), 298, 2); FullLineSprite.drawString(String(amscansens), 298, 2);
break; break;
case CONNECTIVITY:
FullLineSprite.setTextDatum(TL_DATUM);
FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
FullLineSprite.drawString(removeNewline(myLanguage[language][298]), 6, 2);
FullLineSprite.setTextDatum(TR_DATUM);
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
FullLineSprite.drawString((clockampm ? "12" : "24"), 298, 2);
break;
case DXMODE: case DXMODE:
FullLineSprite.setTextDatum(TL_DATUM); FullLineSprite.setTextDatum(TL_DATUM);
FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false); FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
@@ -2587,6 +2597,15 @@ void ShowOneButton(byte position, byte item, bool selected) {
PSSprite.drawString(String(amscansens), 75, 15); PSSprite.drawString(String(amscansens), 75, 15);
break; break;
case CONNECTIVITY:
PSSprite.setTextDatum(TC_DATUM);
PSSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
PSSprite.drawString(shortLine(removeNewline(myLanguage[language][298])), 75, 1);
PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
PSSprite.drawString((clockampm ? "12" : "24"), 75, 15);
break;
case DXMODE: case DXMODE:
PSSprite.setTextDatum(TC_DATUM); PSSprite.setTextDatum(TC_DATUM);
PSSprite.setTextColor(ActiveColor, ActiveColorSmooth, false); PSSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
@@ -3826,6 +3845,13 @@ void MenuUp() {
OneBigLineSprite.drawString((autoDST ? myLanguage[language][42] : myLanguage[language][30]), 135, 0); OneBigLineSprite.drawString((autoDST ? myLanguage[language][42] : myLanguage[language][30]), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
case ITEM9:
clockampm = !clockampm;
OneBigLineSprite.drawString((clockampm ? "12" : "24"), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
break;
} }
break; break;
@@ -4804,6 +4830,13 @@ void MenuDown() {
OneBigLineSprite.drawString((autoDST ? myLanguage[language][42] : myLanguage[language][30]), 135, 0); OneBigLineSprite.drawString((autoDST ? myLanguage[language][42] : myLanguage[language][30]), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
case ITEM9:
clockampm = !clockampm;
OneBigLineSprite.drawString((clockampm ? "12" : "24"), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
break;
} }
break; break;
@@ -5840,6 +5873,13 @@ void DoMenu() {
OneBigLineSprite.drawString((autoDST ? myLanguage[language][42] : myLanguage[language][30]), 135, 0); OneBigLineSprite.drawString((autoDST ? myLanguage[language][42] : myLanguage[language][30]), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
case ITEM9:
Infoboxprint(myLanguage[language][298]);
OneBigLineSprite.drawString((clockampm ? "12" : "24"), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
break;
} }
break; break;
+1
View File
@@ -22,6 +22,7 @@ extern bool autosquelch;
extern bool BWreset; extern bool BWreset;
extern bool BWtune; extern bool BWtune;
extern bool change; extern bool change;
extern bool clockampm;
extern bool compressedold; extern bool compressedold;
extern bool dropout; extern bool dropout;
extern bool dynamicPTYold; extern bool dynamicPTYold;
+1 -1
View File
@@ -809,7 +809,7 @@ void showCT() {
} }
// Format the time based on region // Format the time based on region
if (radio.rds.region == 1) { // USA region: 12-hour AM/PM format if (clockampm) { // USA region: 12-hour AM/PM format
// Determine AM/PM and adjust hour format // Determine AM/PM and adjust hour format
int hour = localtime(&t)->tm_hour; int hour = localtime(&t)->tm_hour;
String ampm = (hour >= 12) ? "PM" : "AM"; String ampm = (hour >= 12) ? "PM" : "AM";
+1
View File
@@ -18,6 +18,7 @@ extern bool artheadold;
extern bool BWreset; extern bool BWreset;
extern bool compressedold; extern bool compressedold;
extern bool clearrds; extern bool clearrds;
extern bool clockampm;
extern bool dropout; extern bool dropout;
extern bool dynamicPTYold; extern bool dynamicPTYold;
extern bool fullsearchrds; extern bool fullsearchrds;