Skip to content

Commit 78e81e5

Browse files
committed
lat/long setting bugfixes; readme update
1 parent ee5db6d commit 78e81e5

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The clock displays its software version when powered up (as of v1.6). [Instructi
2121

2222
### Time of Day
2323

24-
The time of day is shown in 12h or 24h format per the [options menu](#options-menu), but when setting, it is shown in 24h so you can tell AM from PM. When exiting setting, seconds will set to zero, unless the time was not changed.
24+
The time of day is shown in 12h or 24h format per the [options menu](#options-menu), but when setting, it is shown in 24h so you can tell AM from PM. When exiting setting, seconds will reset to zero, unless the time was not changed.
2525

2626
### Calendar
2727

@@ -30,22 +30,23 @@ The calendar cycles through several displays, before returning to the time of da
3030
* **The date.** Several formats are available in the [options menu](#options-menu). When setting, it will ask for the year, then the month, then the date.
3131
* **Day counter.** This will count down to, or up from, a date of your choice, repeating every year. When setting, it will ask for the month, then the date, then the direction (0 = count down, 1 = count up).
3232
* TIP: To display the day of the year, set it to count up from December 31.
33-
* **Sunrise and sunset.** These two displays show the previous and next sunrise or sunset (indicated by `1` or `0` on the seconds tubes), in the same 12h/24h format as the time of day. This is based on the latitude, longitude, and UTC offset you specify in the [options menu](#options-menu).
33+
* **Sunrise/sunset.** These two displays show the previous and next apparent sunrise/sunset times (indicated by `1` or `0` on the seconds tubes – during the day, it shows sunrise then sunset; at night, sunset then sunrise). The times are calculated using the latitude, longitude, UTC offset, and auto DST rule specified in the [options menu](#options-menu), and shown in the same 12h/24h format as the time of day.
34+
* NOTE: At this writing, the times may be incorrect by a few minutes, depending on [your longitude and time of year](https://docs.google.com/spreadsheets/d/1dYchVCJAuhvosrCdtEeHLT3ZXcLZK8X0UtENItZR32M/edit#gid=0). I believe this to be a rounding error(s) in the [Dusk2Dawn library](https://github.com/dmkishi/Dusk2Dawn) (compared to the [NOAA Solar Calculator](https://www.esrl.noaa.gov/gmd/grad/solcalc/) it’s based on) and plan to investigate.
3435

3536
### Alarm
3637

3738
The alarm is always shown in 24h format so you can tell AM from PM.
3839

3940
* Use **Up/Down** to switch the alarm between **on, skip, and off** (indicated by `1`/`01`/`0` on the seconds tubes, and/or high/medium/low beeps).
40-
* When the alarm sounds, press any button to snooze it, and again to cancel the snooze, which will silence it until the next alarm time (it will give a short low beep, and the display will blink once).
41+
* When the alarm sounds, press any button – once to snooze, and again to cancel the snooze / silence the alarm for the day (it will give a short low beep, and the display will blink once).
4142
* **Skip** silences the next alarm in advance – useful if you’re taking a day off, or you wake up before your alarm. In the [options menu](#options-menu), you can program the alarm to skip automatically during the work week or on weekends – and when this is active, you can also _unskip_ the next alarm by simply switching it back on. The [Alt button](#the-alt-button) can be set to toggle the skip setting.
4243

4344
### Countdown Timer
4445

4546
The countdown timer can be set up to 18 hours, and can be configured as an interval timer in the [options menu](#options-menu).
4647

4748
* The timer will begin running as soon as you finish setting it. If you switch to another display, the timer will continue to run in the background. If power is lost, the timer will clear.
48-
* To cancel the running timer, hold **Select** while the timer is displayed.
49+
* To cancel the running timer, hold **Select** while the timer is shown.
4950
* When the timer sounds, press any button to silence it.
5051

5152
### The Alt Button
@@ -97,7 +98,7 @@ If your clock has an **Alt** button, it will do one of two things (depending on
9798
| 47 | Work ends at | Time of day. |
9899
| | **Geography** | |
99100
| 50 | Latitude | Your latitude, in tenths of a degree; negative (south) values are indicated with leading zeroes. (Example: Dallas is at 32.8°N, set as `328`.) |
100-
| 51 | Longitude | Your longitude, in tenths of a degree; negative (west) values are indicated with leading zeroes. (Example: Dallas is at 96.7°W, set as `00967`.)<br/>For these two options, four-tube clocks will not display the tenths digit. |
101+
| 51 | Longitude | Your longitude, in tenths of a degree; negative (west) values are indicated with leading zeroes. (Example: Dallas is at 96.7°W, set as `00967`.) |
101102
| 52 | UTC offset | Your time zone’s offset from UTC (non-DST), in hours and minutes; negative (west) values are indicated with leading zeroes. (Example: Dallas is UTC–6, set as `0600`.) |
102103

103104
To reset the clock to “factory” defaults, hold **Select** while powering up the clock.

arduino-nixie/arduino-nixie.ino

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ Some are skipped when they wouldn't apply to a given clock's hardware config, se
8484
const byte optsNum[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13, 20,21,22, 30,31,32, 40, 41, 42,43,44,45, 46, 47, 50, 51, 52};
8585
const byte optsLoc[] = {16,17,18,19,20,22,26,46,45, 23,42,39,24, 25,43,40, 21,44,41, 27, 28, 30,32,33,34, 35, 37, 10, 12, 14};
8686
const int optsDef[] = { 2, 1, 0, 0, 5, 0, 1, 0, 0, 0, 0,61, 9, 0, 0,61, 0, 0,61, 0,1320, 360, 0, 1, 5, 480,1020, 0, 0,100};
87-
const int optsMin[] = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,49, 0, 0, 0,49, 0, 0,49, 0, 0, 0, 0, 0, 0, 0, 0, -1800,-1800, 52};
88-
const int optsMax[] = { 2, 5, 3, 1,20, 6, 4, 2, 1, 2, 1,88,60, 1, 1,88, 4, 1,88, 2,1439,1439, 2, 6, 6,1439,1439, 1800, 1800,156};
87+
const int optsMin[] = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,49, 0, 0, 0,49, 0, 0,49, 0, 0, 0, 0, 0, 0, 0, 0, -900,-1800, 52};
88+
const int optsMax[] = { 2, 5, 3, 1,20, 6, 4, 2, 1, 2, 1,88,60, 1, 1,88, 4, 1,88, 2,1439,1439, 2, 6, 6,1439,1439, 900, 1800,156};
8989

9090
//RTC objects
9191
DS3231 ds3231; //an object to access the ds3231 specifically (temp, etc)
@@ -1044,7 +1044,9 @@ void updateDisplay(){
10441044
} else if(fnSetValMax==156) { //Timezone offset from UTC in quarter hours plus 100 (since we're not set up to support signed bytes)
10451045
editDisplay((abs(fnSetVal-100)*25)/100, 0, 1, fnSetVal<100, false); //hours, leading zero for negatives
10461046
editDisplay((abs(fnSetVal-100)%4)*15, 2, 3, true, false); //minutes, leading zero always
1047-
} else if(fnSetValMax==1800) { //Lat/long: display on slightly different tubes on 4- vs 6-tube clocks
1047+
} else if(fnSetValMax==900 || fnSetValMax==1800) { //Lat/long in tenths of a degree
1048+
//If 6 tubes (0-5), display degrees on 0-3 and tenths on 4, with 5 blank
1049+
//If 4 tubes (0-3), display degrees on 0-2 and tenths on 3
10481050
editDisplay(abs(fnSetVal), 0, (displaySize>4? 4: 3), fnSetVal<0, false);
10491051
} else editDisplay(abs(fnSetVal), 0, 3, fnSetVal<0, false); //some other type of value - leading zeros for negatives
10501052
}
@@ -1274,6 +1276,8 @@ void editDisplay(word n, byte posStart, byte posEnd, bool leadingZeros, bool fad
12741276
case 1: place=10; break;
12751277
case 2: place=100; break;
12761278
case 3: place=1000; break;
1279+
case 4: place=10000; break;
1280+
case 5: place=100000; break;
12771281
default: break;
12781282
}
12791283
displayNext[posEnd-i] = (i==0&&n==0 ? 0 : (n>=place ? (n/place)%10 : (leadingZeros?0:15)));

0 commit comments

Comments
 (0)