Skip to content

Commit 0260c30

Browse files
committed
Add new date formats
1 parent 1067355 commit 0260c30

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _In these instructions, **Select** is the main pushbutton, and **Adjust** can be
1313
| Function | Looks like | Notes |
1414
| --- | --- | --- |
1515
| **Time** | `12 34 56` | The time of day. You can choose 12h or 24h format in Options. When setting, it's in 24h format (so you can tell AM from PM) and the seconds will reset to :00 when you save. The clock keeps time during power outages and compensates for temperature effects. |
16-
| **Date** | `_2 _4 _0`<br/>(for&nbsp;Sun&nbsp;2/4) | You can choose month/date or date/month format in the options menu (2). Setting is done in three stages: first year, then month, then date.<br/>Weekdays are: 0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sat |
16+
| **Date** | `_2 _4 _0`<br/>(for&nbsp;Sun&nbsp;2/4) | You can choose the date format in the options menu (2). Setting is done in three stages: first year, then month, then date.<br/>Weekdays are: 0=Sun, 1=Mon, 2=Tue, 3=Wed, 4=Thu, 5=Fri, 6=Sat |
1717
| **Alarm** | `_7 00 1_` | Shows alarm time (always in 24hr format) and on/off status on 5th tube (1=on, 0=off) and by display brightness (bright=on, dim=off). Use **Adjust** to switch on/off. Hold **Select** to set time (same way as **Time**). When alarm sounds, press **Select** to snooze, or hold for 1sec (followed by a short beep) to silence the alarm for the day. Options menu lets you restrict the alarm to your workweek or weekend only. In a power outage, the alarm will remain set, but it will not sound if power is disconnected at alarm time. |
1818
| **Timer** | `__ __ _0` | A countdown timer, in hours, minutes, and seconds; or `0` when stopped. Can be set to the minute, up to 18 hours. Begins running as soon as you set it, and will continue to run in the background if you change to a different function. To cancel while running, hold **Select**. When timer runs out, press **Select** to silence. If power is lost, the timer will reset to `0`. |
1919
| **Day counter** | `_1 23 __` | Shows the number of days until/since a date you specify. Set the same way as **Date.** |
@@ -30,7 +30,7 @@ _In these instructions, **Select** is the main pushbutton, and **Adjust** can be
3030
| --- | --- |
3131
| **Timekeeping and display** ||
3232
| 1. Time format | 1 = 12-hour<br/>2 = 24-hour<br/>(time-of-day display only; setting times is always done in 24h) |
33-
| 2. Date format | 1 = month/date<br/>2 = date/month |
33+
| 2. Date format | 1 = month/date/weekday<br/>2 = date/month/weekday<br/>3 = month/date/year<br/>4 = date/month/year<br/>5 = year/month/date<br/>Note that four-tube clocks will not display the third value. |
3434
| 3. Display date during time? | 0 = never<br/>1 = date instead of seconds<br/>2 = full date (as above) every minute at :30 seconds |
3535
| 4. Leading zero in hour, date, and month? | 0 = no<br/>1 = yes |
3636
| 5. Digit fade | _Not yet implemented._<br/>0–50 (in hundredths of a second) |

sixtube_lm/sixtube_lm.ino

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ These ones are set inside the options menu - defaults defined in arrays below
139139
const byte optsLoc[] = {16,17,18,19,20,22,23,24,39,25,40,21,41,27, 28, 30,32,33,34, 35, 37};
140140
const word optsDef[] = { 2, 1, 0, 0, 0, 0, 0, 0,61, 0,61, 0,61, 0,1320, 360, 0, 1, 5, 480,1020};
141141
const word optsMin[] = { 1, 1, 0, 0, 0, 0, 0, 0,49, 0,49, 0,49, 0, 0, 0, 0, 0, 0, 0, 0};
142-
const word optsMax[] = { 2, 2, 2, 1,50, 6, 2,60,88, 1,88, 4,88, 2,1439,1439, 2, 6, 6,1439,1439};
142+
const word optsMax[] = { 2, 5, 2, 1,50, 6, 2,60,88, 1,88, 4,88, 2,1439,1439, 2, 6, 6,1439,1439};
143143

144144
//RTC objects
145145
DS3231 ds3231; //an object to access the ds3231 specifically (temp, etc)
@@ -884,10 +884,17 @@ void updateDisplay(){
884884
else editDisplay(tod.second(), 4, 5, true); //seconds
885885
break;
886886
case fnIsDate:
887-
editDisplay(readEEPROM(17,false)==1?tod.month():tod.day(), 0, 1, readEEPROM(19,false));
888-
editDisplay(readEEPROM(17,false)==1?tod.day():tod.month(), 2, 3, readEEPROM(19,false));
889-
blankDisplay(4, 4);
890-
editDisplay(toddow, 5, 5, false); //TODO is this 0=Sunday, 6=Saturday?
887+
byte df; df = readEEPROM(17,false); //1=m/d/w, 2=d/m/w, 3=m/d/y, 4=d/m/y, 5=y/m/d
888+
if(df<=4) {
889+
editDisplay((df==1||df==3?tod.month():tod.day()),0,1,readEEPROM(19,false)); //month or date first
890+
editDisplay((df==1||df==3?tod.day():tod.month()),2,3,readEEPROM(19,false)); //date or month second
891+
editDisplay((df<=2?toddow:tod.year()),4,5,(df<=2?false:true)); //dow or year third - dow never leading zero, year always
892+
}
893+
else { //df==5
894+
editDisplay(tod.year(),0,1,true); //year always has leading zero
895+
editDisplay(tod.month(),2,3,readEEPROM(19,false));
896+
editDisplay(tod.day(),4,5,readEEPROM(19,false));
897+
}
891898
break;
892899
case fnIsDayCount:
893900
long targetDayCount; targetDayCount = dateToDayCount(

0 commit comments

Comments
 (0)