@@ -262,19 +262,14 @@ void ctrlEvt(byte ctrl, byte evt){
262
262
if (fn < fnOpts) { // normal fn running/setting (not in options menu)
263
263
264
264
if (evt==3 && ctrl==mainSel) { // mainSel long hold: enter options menu
265
- // Serial.println("running/setting: mainSel long hold: enter options menu"); Serial.println();
266
265
btnStop ();
267
266
fn = fnOpts;
268
267
clearSet (); // don't need updateDisplay() here because this calls updateRTC with force=true
269
268
return ;
270
269
}
271
270
272
271
if (!fnSetPg) { // fn running
273
- // Serial.print("fn ");
274
- // Serial.print(fn,DEC);
275
- // Serial.println(" running");
276
- if (evt==2 && ctrl==mainSel) { // sel hold: enter setting mode
277
- // Serial.println(" mainSel hold: enter setting");
272
+ if (evt==2 && ctrl==mainSel) { // mainSel hold: enter setting mode
278
273
switch (fn){
279
274
case fnIsTime: // set mins
280
275
startSet ((tod.hour ()*60 )+tod.minute (),0 ,1439 ,1 ); break ;
@@ -296,18 +291,15 @@ void ctrlEvt(byte ctrl, byte evt){
296
291
return ;
297
292
}
298
293
else if ((ctrl==mainSel && evt==0 ) || ((ctrl==mainAdjUp || ctrl==mainAdjDn) && evt==1 )) { // sel release or adj press - switch fn, depending on config
299
- // Serial.println(" sel release or adj press: switch fn");
300
294
// -1 = nothing, -2 = cycle through functions, other = go to specific function (see fn)
301
295
// we can't handle sel press here because, if attempting to enter setting mode, it would switch the fn first
302
296
bool fnChgd = false ;
303
297
if (ctrl==mainSel && mainSelFn!=-1 ) {
304
- // Serial.println(" mainSel release: go to next fn in the cycle");
305
298
fnChgd = true ;
306
299
if (mainSelFn==-2 ) fnScroll (1 ); // Go to next fn in the cycle
307
300
else fn = mainSelFn;
308
301
}
309
302
else if ((ctrl==mainAdjUp || ctrl==mainAdjDn) && mainAdjFn!=-1 ) {
310
- // Serial.println(" mainAdj press: go to prev/next fn in the cycle");
311
303
fnChgd = true ;
312
304
if (mainAdjFn==-2 ) fnScroll (ctrl==mainAdjUp?1 :-1 ); // Go to next or previous fn in the cycle
313
305
else fn = mainAdjFn;
@@ -325,20 +317,16 @@ void ctrlEvt(byte ctrl, byte evt){
325
317
} // end fn running
326
318
327
319
else { // fn setting
328
- // Serial.print("fn ");
329
- // Serial.print(fn,DEC);
330
- // Serial.println(" setting");
331
320
if (evt==1 ) { // we respond only to press evts during fn setting
332
321
if (ctrl==mainSel) { // mainSel push: go to next option or save and exit setting mode
333
- // Serial.println(" mainSel push: go to next option or save and exit setting mode");
334
322
btnStop (); // not waiting for mainSelHold, so can stop listening here
335
323
// We will set ds3231 time parts directly
336
324
// con: potential for very rare clock rollover while setting; pro: can set date separate from time
337
325
switch (fn){
338
326
case fnIsTime: // save in RTC
339
327
ds3231.setHour (fnSetVal/60 );
340
328
ds3231.setMinute (fnSetVal%60 );
341
- ds3231.setSecond (0 ); // will reset to exactly 0? TODO confirm
329
+ ds3231.setSecond (0 );
342
330
clearSet (); break ;
343
331
case fnIsDate: // save in RTC
344
332
switch (fnSetPg){
@@ -388,34 +376,27 @@ void ctrlEvt(byte ctrl, byte evt){
388
376
} // end normal fn running/setting
389
377
390
378
else { // options menu setting - to/from EEPROM
391
- // Serial.print("opt ");
392
- // Serial.print(fn,DEC);
393
379
394
380
if (evt==2 && ctrl==mainSel) { // mainSel short hold: exit options menu
395
- // Serial.println(" mainSel short hold: exit options menu");
396
381
btnStop ();
397
- // if we're setting a value, writes setting val to EEPROM if needed
382
+ // if we were setting a value, writes setting val to EEPROM if needed
398
383
if (fnSetPg) writeEEPROM (optsLoc[fnSetPg],fnSetVal,optsMax[fnSetPg]-optsMin[fnSetPg]>255 ?true :false );
399
384
fn = fnIsTime;
400
385
clearSet ();
401
386
return ;
402
- // showSitch();
403
387
}
404
388
405
389
if (!fnSetPg){ // viewing option number
406
- // Serial.println(" viewing option number");
407
390
if (ctrl==mainSel && evt==0 ) { // mainSel release: enter option value setting
408
- // Serial.println(" mainSel release: enter option value setting");
409
391
byte n = fn-fnOpts+1 ; // For a given options menu option (1-index), read from EEPROM and call startSet
410
392
startSet (readEEPROM (optsLoc[n],optsMax[n]-optsMin[n]>255 ?true :false ),optsMin[n],optsMax[n],n);
411
393
}
412
394
if (ctrl==mainAdjUp && evt==1 ) fnOptScroll (1 ); // next one up or cycle to beginning
413
395
if (ctrl==mainAdjDn && evt==1 ) fnOptScroll (-1 ); // next one down or cycle to end?
414
396
updateDisplay ();
415
- // showSitch();
416
397
} // end viewing option number
398
+
417
399
else { // setting option value
418
- // Serial.println(" setting option value");
419
400
if (ctrl==mainSel && evt==0 ) { // mainSel release: save and exit option value setting
420
401
// Writes setting val to EEPROM if needed
421
402
writeEEPROM (optsLoc[fnSetPg],fnSetVal,optsMax[fnSetPg]-optsMin[fnSetPg]>255 ?true :false );
@@ -426,22 +407,9 @@ void ctrlEvt(byte ctrl, byte evt){
426
407
updateDisplay ();
427
408
} // end setting option value
428
409
} // end options menu setting
429
- // Serial.println(" ");
430
410
431
411
} // end ctrlEvt
432
412
433
- void showSitch (){
434
- Serial.print (" --- fn=" );
435
- Serial.print (fn,DEC);
436
- Serial.print (" , fnSetPg=" );
437
- Serial.print (fnSetPg,DEC);
438
- Serial.print (" , fnSetVal=" );
439
- Serial.print (fnSetVal,DEC);
440
- Serial.print (" ---" );
441
- Serial.println ();
442
- Serial.println ();
443
- }
444
-
445
413
void fnScroll (char dir){
446
414
// Switch to the next (1) or previous (-1) fn in fnsEnabled
447
415
byte pos;
0 commit comments