Skip to content

Commit ec210c7

Browse files
committed
Continue modularizing; reduce flash writes
1 parent 031ff5d commit ec210c7

19 files changed

+410
-288
lines changed

arduino-nixie/arduino-nixie.h

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Universal digital clock codebase for Arduino - https://github.com/clockspot/arduino-clock
2+
// Sketch by Luke McKenzie (luke@theclockspot.com)
3+
// Written to support RLB Designs’ Universal Nixie Driver Board
4+
// Inspired by original sketch by Robin Birtles (rlb-designs.com) and Chris Gerekos
5+
6+
////////// Hardware configuration //////////
7+
//Include the config file that matches your hardware setup. If needed, duplicate an existing one.
8+
9+
#include "configs/led-iot.h"
10+
//#include "configs/undb-v9-relay.h"
11+
12+
13+
14+
15+
//Unique IDs for the functions - see also fnScroll
16+
#define FN_TOD 0 //time of day
17+
#define FN_CAL 1 //date, with optional day counter and sunrise/sunset pages
18+
#define FN_ALARM 2 //alarm time
19+
#define FN_TIMER 3 //countdown timer and chronograph
20+
#define FN_THERM 4 //temperature per rtc – will likely read high
21+
#define FN_TUBETEST 5 //simply cycles all digits for nixie tube testing
22+
#define FN_OPTS 201 //fn values from here to 255 correspond to settings in the settings menu
23+
24+
void setup();
25+
void loop();
26+
void ctrlEvt(byte ctrl, byte evt, byte evtLast);
27+
void fnScroll(byte dir);
28+
void fnOptScroll(byte dir);
29+
void goToFn(byte thefn, byte thefnPg=0);
30+
void switchAlarmState(byte dir);
31+
void setAlarmState(byte state);
32+
byte getAlarmState();
33+
void switchPower(byte dir);
34+
void startSet(int n, int m, int x, byte p);
35+
void doSet(int delta);
36+
void clearSet();
37+
bool initEEPROM(bool hard);
38+
void findFnAndPageNumbers();
39+
void checkRTC(bool force);
40+
void fibonacci(byte h, byte m, byte s);
41+
void autoDST();
42+
bool isDST(int y, byte m, byte d);
43+
bool isDSTByHour(int y, byte m, byte d, byte h, bool setFlag);
44+
byte nthSunday(int y, byte m, byte nth);
45+
byte daysInMonth(word y, byte m);
46+
int daysInYear(word y);
47+
int dateToDayCount(word y, byte m, byte d);
48+
byte dayOfWeek(word y, byte m, byte d);
49+
int dateComp(int y, byte m, byte d, byte mt, byte dt, bool countUp);
50+
bool isTimeInRange(word tstart, word tend, word ttest);
51+
bool isDayInRange(byte dstart, byte dend, byte dtest);
52+
void millisCheckDrift();
53+
void millisApplyDrift();
54+
void millisReset();
55+
unsigned long ms();
56+
void timerStart();
57+
void timerStop();
58+
void timerClear();
59+
void timerLap();
60+
void timerRunoutToggle();
61+
void cycleTimer();
62+
void timerSleepSwitch(bool on);
63+
byte getTimerState();
64+
void setTimerState(char pos, bool val);
65+
void tempDisplay(int i0, int i1=0, int i2=0, int i3=0);
66+
void updateDisplay();
67+
void calcSun();
68+
void displaySun(byte which, int d, int tod);
69+
void displayWeather(byte which);
70+
void initOutputs();
71+
void signalStart(byte sigFn, byte sigDur);
72+
void signalStop();
73+
void cycleSignal();
74+
word getSignalPitch();
75+
word getHz(byte note);
76+
byte getSignalOutput();
77+
byte getSignalPattern();
78+
void quickBeep(int pitch);
79+
void quickBeepPattern(int source, int pattern);
80+
void updateBacklight();
81+
void cycleBacklight();

arduino-nixie/arduino-nixie.ino

Lines changed: 205 additions & 221 deletions
Large diffs are not rendered by default.

arduino-nixie/configs/led-iot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
//Soft power switches
9090
#define ENABLE_SOFT_ALARM_SWITCH 1
91-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
91+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
9292
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
9393
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
9494
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

arduino-nixie/configs/undb-v5.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101

102102
//Soft power switches
103103
#define ENABLE_SOFT_ALARM_SWITCH 1
104-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
104+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
105105
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
106106
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
107107
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

arduino-nixie/configs/undb-v8-simplified.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109

110110
//Soft power switches
111111
#define ENABLE_SOFT_ALARM_SWITCH 1
112-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
112+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
113113
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
114114
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
115115
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

arduino-nixie/configs/undb-v8.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109

110110
//Soft power switches
111111
#define ENABLE_SOFT_ALARM_SWITCH 1
112-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
112+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
113113
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
114114
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
115115
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

arduino-nixie/configs/undb-v9-relay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111
//Soft power switches
112112
#define ENABLE_SOFT_ALARM_SWITCH 1
113-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
113+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
114114
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
115115
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
116116
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

arduino-nixie/configs/undb-v9-simplified.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111
//Soft power switches
112112
#define ENABLE_SOFT_ALARM_SWITCH 1
113-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
113+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
114114
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
115115
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
116116
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

arduino-nixie/configs/undb-v9.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111
//Soft power switches
112112
#define ENABLE_SOFT_ALARM_SWITCH 1
113-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
113+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
114114
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
115115
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
116116
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

arduino-nixie/configs/~sample.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147

148148
//Soft power switches
149149
#define ENABLE_SOFT_ALARM_SWITCH 1
150-
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
150+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (FN_ALARM).
151151
// 0 = no. Alarm will be permanently on. Use with switch signal if the appliance has its own switch on this circuit (and note that, if another signal type(s) is available and selected for the alarm, the user won't be able to switch it off). Also disables skip feature. Note that the instructions do not reflect this option.
152152
#define ENABLE_SOFT_POWER_SWITCH 1 //switch signal only
153153
// 1 = yes. Switch signal can be toggled on and off directly with Alt button at any time (except in settings menu). This is useful if connecting an appliance (e.g. radio) that doesn't have its own switch, or if replacing the clock unit in a clock radio where the clock does all the switching (e.g. Telechron).

0 commit comments

Comments
 (0)