From 3afac056d4467c9d40841a78bddbc677b8c97d5d Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 16 May 2017 16:45:03 +0000 Subject: [PATCH] Resolve #19: added OPT_HIDE_LEADING_ZEROES --- README.md | 3 +++ SODA_POP/display.ino | 15 +++++++++++---- SODA_POP/settings.h | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 31c79a1..1b311fc 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,7 @@ uploading the code to the chip. There are several features that can be added to the rig if you want to. This is done by adding and removing `#define` lines to `settings.h`. +- `OPT_HIDE_LEADING_ZEROES`: hide leading zeroes on frequency display. - `OPT_BAND_SELECT`: change the band by pressing RIT for 2s. - `OPT_AUTO_BAND`: auto-select bands using a PCA9536 PIO (thanks VK3IL). - `OPT_ERASE_EEPROM`: erase the EEPROM by holding RIT for 8s. @@ -212,6 +213,8 @@ Some images of the connections: - 2017-05-16: - `OPT_AUTO_BAND` (PR [#22](/../../pull/22) by VK3IL) + - Made hiding leading zeroes on frequency display a compile-time option + (`OPT_HIDE_LEADING_ZEROES`; issue [#19](/../../issues/19)) - 2017-05-12: - VK band plans (PR [#21](/../../pull/21) by VK3IL) - 2017-05-04: diff --git a/SODA_POP/display.ino b/SODA_POP/display.ino index 5ab52b8..bf6cf0a 100644 --- a/SODA_POP/display.ino +++ b/SODA_POP/display.ino @@ -249,16 +249,23 @@ void display_rit() */ void display_freq() { - // First divide by 100 to remove the fractional Hz digits unsigned long frequency = state.op_freq/100; - // Then display the digits one by one +#ifdef OPT_HIDE_LEADING_ZEROES + noInterrupts(); +#endif state.display.digits[3] = LED_DIGITS[(frequency % 1000000) / 100000]; - if (state.display.digits[3] == LED_N_0) - state.display.digits[3] = 0x00; //blank MSD if 0 state.display.digits[2] = LED_DIGITS[(frequency % 100000) / 10000]; state.display.digits[1] = LED_DIGITS[(frequency % 10000) / 1000]; state.display.digits[0] = LED_DIGITS[(frequency % 1000) / 100]; state.display.dots = 0x2; +#ifdef OPT_HIDE_LEADING_ZEROES + if (state.display.digits[3] == LED_N_0) { + state.display.digits[3] = 0x00; + if (state.display.digits[2] == LED_N_0) + state.display.digits[2] = 0x00; + } + interrupts(); +#endif state.display.blinking = tuning_blinks[state.tuning_step]; } diff --git a/SODA_POP/settings.h b/SODA_POP/settings.h index 8ab9125..af6d8a1 100644 --- a/SODA_POP/settings.h +++ b/SODA_POP/settings.h @@ -35,6 +35,9 @@ /* Custom features. For more details, see README.md. */ +/* Hide leading zeroes on the frequency display */ +#define OPT_HIDE_LEADING_ZEROES + /* Band selection by pressing RIT for 2s */ #define OPT_BAND_SELECT