Skip to content

Commit c84c761

Browse files
committed
Several Bugs fixed on SETUP mode and some code optimizations for small size
1 parent 28f9513 commit c84c761

File tree

3 files changed

+59
-44
lines changed

3 files changed

+59
-44
lines changed

arduino-arcs.ino

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@
7575
// Smeter on the LCD?
7676
#define SMETER True
7777

78+
// You have two alternatives for the SMeter graphics
79+
// The default is a simple bar with 24 points (high) resolution
80+
// The alternative is a low resolution one with 12 points
81+
// but numbers in the 1-3-5-7-9-+20
82+
//
83+
// If you want the alternative just uncomment this code below
84+
// the alternative willl cost you about 10 bytes of firmware
85+
//#define SMETER_ALT True
86+
7887
// do you have an LCD?
7988
#define LCD True
8089

@@ -299,15 +308,6 @@ struct userData u;
299308
#endif // smeter
300309
#endif // nolcd
301310

302-
// You have two alternatives for the SMeter graphics
303-
// The default is a simple bar with 24 points (high) resolution
304-
// The alternative is a low resolution one with 12 points
305-
// but numbers in the 1-3-5-7-9-+20
306-
//
307-
// If you want the alternative just uncomment this code below
308-
// the alternative willl cost you about 10 bytes of firmware
309-
#define SMETER_ALT True
310-
311311
// run mode constants
312312
#define MODE_LSB 0
313313
#define MODE_USB 1
@@ -522,6 +522,13 @@ void swapVFO(byte force = 2) {
522522
}
523523

524524

525+
// print the "A"/"B" letter to match the selected VFO, a trick to save space
526+
void vfoLetter() {
527+
if (activeVFO) lcd.print("A");
528+
else lcd.print("B");
529+
}
530+
531+
525532
// beep function
526533
#ifdef ROTARY
527534
// beep function a 1.2Khz tone for 50 msecs

fa-lcd.ino

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,14 @@
3737
belowZero(&u.if2);
3838
break;
3939
case CONFIG_VFO_A:
40-
// change VFOa
41-
swapVFO(0); // set a
42-
*ptrVFO += getStep() * dir;
43-
belowZero(ptrVFO);
44-
break;
4540
case CONFIG_VFO_B:
46-
// change VFOb
47-
swapVFO(1); // set b
48-
*ptrVFO += getStep() * dir;
49-
belowZero(ptrVFO);
41+
// update freq
42+
updateFreq(dir);
5043
break;
51-
case CONFIG_MODE_A: // whichever VFO is active
44+
case CONFIG_MODE_A:
5245
case CONFIG_MODE_B:
53-
// hot swap it
46+
// update mode
5447
changeMode();
55-
// set the default mode in the VFO A
56-
showModeSetup(*ptrMode);
5748
break;
5849
case CONFIG_USB:
5950
// change the mode to USB
@@ -96,6 +87,30 @@
9687
if (tconfig < 0) tconfig = CONFIG_MAX;
9788
config = tconfig;
9889

90+
// force specific VFO/MODE operations by config items
91+
92+
// force VFO A Operation
93+
tbool = (config == CONFIG_VFO_A) or (config == CONFIG_MODE_A);
94+
if (tbool) swapVFO(1);
95+
96+
// force VFO B Operation
97+
tbool = (config == CONFIG_VFO_B) or (config == CONFIG_MODE_B);
98+
if (tbool) swapVFO(0);
99+
100+
// force USB
101+
if (config == CONFIG_USB) *ptrMode = MODE_USB;
102+
103+
// force CW
104+
if (config == CONFIG_CW) *ptrMode = MODE_CW;
105+
106+
// force LSB for all config modes with no specific mode
107+
tbool = (config == CONFIG_IF) or (config == CONFIG_IF2);
108+
tbool |= (config == CONFIG_PPM);
109+
if (tbool) *ptrMode = MODE_LSB;
110+
111+
// set all freqs to apply any changes
112+
updateAllFreq();
113+
99114
// update the LCD
100115
showConfig();
101116
}
@@ -111,16 +126,16 @@
111126
lcd.print(F(" High IF (opt) "));
112127
break;
113128
case CONFIG_VFO_A:
114-
lcd.print(F(" VFO A freq "));
115-
break;
116129
case CONFIG_VFO_B:
117-
lcd.print(F(" VFO B freq "));
130+
lcd.print(F(" VFO "));
131+
vfoLetter();
132+
lcd.print(F(" freq "));
118133
break;
119134
case CONFIG_MODE_A:
120-
lcd.print(F(" VFO A mode "));
121-
break;
122135
case CONFIG_MODE_B:
123-
lcd.print(F(" VFO B mode "));
136+
lcd.print(F(" VFO "));
137+
vfoLetter();
138+
lcd.print(F(" mode "));
124139
break;
125140
case CONFIG_USB:
126141
lcd.print(F(" BFO freq. USB "));
@@ -162,7 +177,8 @@
162177

163178
// Show the sign only on config and not VFO & IF
164179
boolean t;
165-
t = config == CONFIG_VFO_A or config == CONFIG_IF;
180+
t = (config == CONFIG_VFO_A) or (config == CONFIG_VFO_B);
181+
t |= (config == CONFIG_IF);
166182
if (!runMode and !t) showSign(val);
167183

168184
// print it
@@ -189,16 +205,12 @@
189205
showConfigValue(u.if2);
190206
break;
191207
case CONFIG_VFO_A:
192-
showConfigValue(u.a);
193-
break;
194208
case CONFIG_VFO_B:
195-
showConfigValue(u.b);
209+
showConfigValue(*ptrVFO);
196210
break;
197211
case CONFIG_MODE_A:
198-
showModeSetup(u.aMode);
199-
break;
200212
case CONFIG_MODE_B:
201-
showModeSetup(u.bMode);
213+
showModeSetup(*ptrMode);
202214
break;
203215
case CONFIG_USB:
204216
showConfigValue(u.usb);
@@ -319,12 +331,8 @@
319331

320332
// first line
321333
lcd.setCursor(0, 0);
322-
// active a?
323-
if (activeVFO) {
324-
lcd.print("A");
325-
} else {
326-
lcd.print("B");
327-
}
334+
// active vfo
335+
vfoLetter();
328336

329337
// split?
330338
if (split) {
@@ -335,7 +343,6 @@
335343
spaces(2);
336344
}
337345

338-
339346
// main lcd routine
340347
lcdRefresh();
341348
}

z-end.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ void setup() {
9595
} else {
9696
#ifdef LCD
9797
// full init, LCD banner
98+
lcd.clear();
9899
lcd.setCursor(0, 0);
99-
lcd.print(F("Init EEPROM... "));
100+
lcd.print(F("Init EEPROM"));
100101
lcd.setCursor(0, 1);
101-
lcd.print(F("Please wait... "));
102+
lcd.print(F("Please wait"));
102103
#endif // nolcd
103104

104105
// init eeprom.

0 commit comments

Comments
 (0)