Skip to content

Commit d7a44bb

Browse files
committed
Fix to some #defines about the SMETER and add the Memory Scan feature
1 parent c84c761 commit d7a44bb

File tree

4 files changed

+70
-16
lines changed

4 files changed

+70
-16
lines changed

arduino-arcs.ino

+20-9
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
*******************************************************************************/
6060

6161
// You like to have CAT control (PC control) of the sketch via Serial link?
62-
//#define CAT_CONTROL True
62+
#define CAT_CONTROL True
6363

6464
// Rotary and push control?
6565
#define ROTARY True
@@ -69,9 +69,12 @@
6969
#define ABUT True
7070

7171
// Memories?
72-
//#define MEMORIES True // hard limited to 99 mems (~80 on the ATMEga168)
72+
#define MEMORIES True // hard limited to 99 mems (~80 on the ATMEga168)
7373
// because we have only two spaces to represent that
7474

75+
// Also you want to scan over enabled memories?
76+
#define MEM_SCAN True
77+
7578
// Smeter on the LCD?
7679
#define SMETER True
7780

@@ -261,6 +264,14 @@ struct userData u;
261264
// declaring the main configuration variable for mem storage
262265
struct mmem memo;
263266

267+
// some vars for the memory scan feature if defined
268+
#ifdef MEM_SCAN
269+
// general memscan flag
270+
bool mscan = true;
271+
#define MEM_SCAN_INTERVAL 5000; // in msecs, the time between scan jumps
272+
unsigned long scanTime; // counter against millis
273+
#endif
274+
264275
#else
265276
// Analog buttons with single functions
266277
Button bvfoab = Button(b1, &btnVFOABClick);
@@ -297,14 +308,14 @@ struct userData u;
297308
LiquidCrystal lcd(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
298309

299310
#ifdef SMETER
300-
// how many samples we take in the smeter, we use a 2/3 trick to get some
301-
// inertia and improve the look & feel of the bar
311+
// how many samples we take in the smeter, we use a 2/3 trick
312+
// to get some inertia and improve the look & feel of the bar
302313
#define BARGRAPH_SAMPLES 6
303-
word pep[BARGRAPH_SAMPLES] = {}; // s-meter readings storage
304-
boolean smeterOk = false; // it's ok to show the bar graph
305-
word sMeter = 0; // hold the value of the Smeter readings
306-
// in both RX and TX modes
307-
boolean barReDraw = true; // Smeter bar needs to be redrawn
314+
word pep[BARGRAPH_SAMPLES] = {}; // s-meter readings storage
315+
boolean smeterOk = false; // it's ok to show the bar graph
316+
word sMeter = 0; // the value of the Smeter readings
317+
// in both RX and TX modes
318+
boolean barReDraw = true; // Smeter bar needs to be redrawn
308319
#endif // smeter
309320
#endif // nolcd
310321

fe-eeprom.ino

+21-1
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,28 @@ void loadEEPROMConfig() {
106106

107107
// wipe mem, this is loaded in the init process of the eeprom.
108108
void wipeMEM() {
109-
// run for the entire mem area writing the defaults to it, with no-go flag
109+
// run for the entire mem area writing the defaults to it,
110+
// with no-go flag on it
110111
for (word i = 0; i <= memCount; i++ ) saveMEM(i, 0);
111112
}
112113

114+
115+
#ifdef MEM_SCAN
116+
// check memscan
117+
void checkMemScan() {
118+
// check timer until the next mem jump
119+
if ((mscan == true) and (scanTime < millis())) {
120+
// move to the next mem
121+
do {// increase the mem & check it
122+
mem += 1;
123+
if (mem >= memCount) mem = 0;
124+
} while(!loadMEM(mem));
125+
126+
// reset timer
127+
scanTime = millis() + MEM_SCAN_INTERVAL;
128+
}
129+
}
130+
131+
#endif // mem scan
132+
113133
#endif // memories

ff-abuttons.ino

+11-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
// normal mode
2020
if (runMode) {
2121
#ifdef MEMORIES
22-
// if we are in mem mode VFO A/B switch has no sense
23-
if (!vfoMode) return;
22+
// is the scanning feature turned on?
23+
#ifdef MEM_SCAN
24+
if (!vfoMode) {
25+
mscan != mscan;
26+
return;
27+
}
28+
#endif
2429
#endif
2530

2631
// we force to deactivate the RIT on VFO change, as it will confuse
@@ -163,8 +168,10 @@
163168
// going to deactivate: reset the stored VFO
164169
*ptrVFO = tvfo;
165170
ritActive = false;
166-
// flag to redraw the bar graph
167-
barReDraw = true;
171+
#ifdef SMETER
172+
// flag to redraw the bar graph
173+
barReDraw = true;
174+
#endif
168175
}
169176
}
170177

z-end.ino

+18-2
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,13 @@ void loop() {
226226
if (dbPTT.fell()) {
227227
// line asserted (PTT Closed) going to TX
228228
going2TX();
229+
230+
// clear the memory scan flag if active
231+
#ifdef MEMORIES
232+
#ifdef MEM_SCAN
233+
mscan = false;
234+
#endif
235+
#endif
229236
} else {
230237
// line left open, going to RX
231238
going2RX();
@@ -307,8 +314,10 @@ void loop() {
307314
// decrement timer
308315
if (showStepCounter > 0) {
309316
showStepCounter -= 1;
310-
// flag to redraw the bar graph only if zero
311-
if (showStepCounter == 0) barReDraw = true;
317+
#ifdef SMETER
318+
// flag to redraw the bar graph only if zero
319+
if (showStepCounter == 0) barReDraw = true;
320+
#endif
312321
}
313322
}
314323

@@ -321,4 +330,11 @@ void loop() {
321330
// analog buttons check
322331
abm.check();
323332
#endif
333+
334+
#ifdef MEMORIES
335+
#ifdef MEM_SCAN
336+
// memory scan timming check
337+
checkMemScan();
338+
#endif
339+
#endif
324340
}

0 commit comments

Comments
 (0)