@@ -262,19 +262,14 @@ void ctrlEvt(byte ctrl, byte evt){
262262 if (fn < fnOpts) { // normal fn running/setting (not in options menu)
263263
264264 if (evt==3 && ctrl==mainSel) { // mainSel long hold: enter options menu
265- // Serial.println("running/setting: mainSel long hold: enter options menu"); Serial.println();
266265 btnStop ();
267266 fn = fnOpts;
268267 clearSet (); // don't need updateDisplay() here because this calls updateRTC with force=true
269268 return ;
270269 }
271270
272271 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
278273 switch (fn){
279274 case fnIsTime: // set mins
280275 startSet ((tod.hour ()*60 )+tod.minute (),0 ,1439 ,1 ); break ;
@@ -296,18 +291,15 @@ void ctrlEvt(byte ctrl, byte evt){
296291 return ;
297292 }
298293 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");
300294 // -1 = nothing, -2 = cycle through functions, other = go to specific function (see fn)
301295 // we can't handle sel press here because, if attempting to enter setting mode, it would switch the fn first
302296 bool fnChgd = false ;
303297 if (ctrl==mainSel && mainSelFn!=-1 ) {
304- // Serial.println(" mainSel release: go to next fn in the cycle");
305298 fnChgd = true ;
306299 if (mainSelFn==-2 ) fnScroll (1 ); // Go to next fn in the cycle
307300 else fn = mainSelFn;
308301 }
309302 else if ((ctrl==mainAdjUp || ctrl==mainAdjDn) && mainAdjFn!=-1 ) {
310- // Serial.println(" mainAdj press: go to prev/next fn in the cycle");
311303 fnChgd = true ;
312304 if (mainAdjFn==-2 ) fnScroll (ctrl==mainAdjUp?1 :-1 ); // Go to next or previous fn in the cycle
313305 else fn = mainAdjFn;
@@ -325,20 +317,16 @@ void ctrlEvt(byte ctrl, byte evt){
325317 } // end fn running
326318
327319 else { // fn setting
328- // Serial.print("fn ");
329- // Serial.print(fn,DEC);
330- // Serial.println(" setting");
331320 if (evt==1 ) { // we respond only to press evts during fn setting
332321 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");
334322 btnStop (); // not waiting for mainSelHold, so can stop listening here
335323 // We will set ds3231 time parts directly
336324 // con: potential for very rare clock rollover while setting; pro: can set date separate from time
337325 switch (fn){
338326 case fnIsTime: // save in RTC
339327 ds3231.setHour (fnSetVal/60 );
340328 ds3231.setMinute (fnSetVal%60 );
341- ds3231.setSecond (0 ); // will reset to exactly 0? TODO confirm
329+ ds3231.setSecond (0 );
342330 clearSet (); break ;
343331 case fnIsDate: // save in RTC
344332 switch (fnSetPg){
@@ -388,34 +376,27 @@ void ctrlEvt(byte ctrl, byte evt){
388376 } // end normal fn running/setting
389377
390378 else { // options menu setting - to/from EEPROM
391- // Serial.print("opt ");
392- // Serial.print(fn,DEC);
393379
394380 if (evt==2 && ctrl==mainSel) { // mainSel short hold: exit options menu
395- // Serial.println(" mainSel short hold: exit options menu");
396381 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
398383 if (fnSetPg) writeEEPROM (optsLoc[fnSetPg],fnSetVal,optsMax[fnSetPg]-optsMin[fnSetPg]>255 ?true :false );
399384 fn = fnIsTime;
400385 clearSet ();
401386 return ;
402- // showSitch();
403387 }
404388
405389 if (!fnSetPg){ // viewing option number
406- // Serial.println(" viewing option number");
407390 if (ctrl==mainSel && evt==0 ) { // mainSel release: enter option value setting
408- // Serial.println(" mainSel release: enter option value setting");
409391 byte n = fn-fnOpts+1 ; // For a given options menu option (1-index), read from EEPROM and call startSet
410392 startSet (readEEPROM (optsLoc[n],optsMax[n]-optsMin[n]>255 ?true :false ),optsMin[n],optsMax[n],n);
411393 }
412394 if (ctrl==mainAdjUp && evt==1 ) fnOptScroll (1 ); // next one up or cycle to beginning
413395 if (ctrl==mainAdjDn && evt==1 ) fnOptScroll (-1 ); // next one down or cycle to end?
414396 updateDisplay ();
415- // showSitch();
416397 } // end viewing option number
398+
417399 else { // setting option value
418- // Serial.println(" setting option value");
419400 if (ctrl==mainSel && evt==0 ) { // mainSel release: save and exit option value setting
420401 // Writes setting val to EEPROM if needed
421402 writeEEPROM (optsLoc[fnSetPg],fnSetVal,optsMax[fnSetPg]-optsMin[fnSetPg]>255 ?true :false );
@@ -426,22 +407,9 @@ void ctrlEvt(byte ctrl, byte evt){
426407 updateDisplay ();
427408 } // end setting option value
428409 } // end options menu setting
429- // Serial.println(" ");
430410
431411} // end ctrlEvt
432412
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-
445413void fnScroll (char dir){
446414 // Switch to the next (1) or previous (-1) fn in fnsEnabled
447415 byte pos;
0 commit comments