Skip to content

Commit

Permalink
Resolve #19: added OPT_HIDE_LEADING_ZEROES
Browse files Browse the repository at this point in the history
  • Loading branch information
camilstaps committed May 16, 2017
1 parent 2f0ad19 commit 3afac05
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
15 changes: 11 additions & 4 deletions SODA_POP/display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
3 changes: 3 additions & 0 deletions SODA_POP/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3afac05

Please sign in to comment.