Skip to content

Commit

Permalink
Merge pull request #10 from clockspot/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
clockspot authored Mar 12, 2021
2 parents 4e58a5d + 43bf05e commit 91c14f4
Show file tree
Hide file tree
Showing 38 changed files with 3,936 additions and 1,952 deletions.
156 changes: 156 additions & 0 deletions INSTRUCTIONS.md

Large diffs are not rendered by default.

221 changes: 60 additions & 161 deletions README.md

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# To-dos

* Timer count up, ending options - maybe separate chrono and timer à la Timex?
* Different setting option for pushbutton (à la Timex) vs. rotary (à la microwave ovens) - external file?
* Startup SEL hold doesn't seem to work with IMU
* Reintroduce nixie clean and scroll
* Persistent storage on EEPROM - find a solution that writes to flash less often
* Network/NTP
* Why does the page sometimes drop?
* wi-fi credential save fails if keys are part of the string?
* DST calc may behave unpredictably between 1–2am on fallback day
* Redo NTP if it failed (networkStartWifi()) - per bad response - how to make it wait a retry period
* Make [2036-ready](https://en.wikipedia.org/wiki/Year_2038_problem#Network_Time_Protocol_timestamps)
* Notice when a leap second is coming and handle it
* When setting page is used to set day counter and date, and the month changes, set date max. For 2/29 it should just do 3/1 probably.
* Weather support
* Stop using strings? There is plenty of RAM available on SAMD I think
* Input: support other IMU orientations
* When day counter is set to count up from 12/31, override to display 365/366 on that date
* Bitmask to enable/disable features?
* Option to display weekdays as Sun=0 or Sun=1 (per Portuguese!)
* When setting times of day, make 1439 (minutes) roll over to 0 and vice versa
* Implement options for full date every 5 minutes
* Is it possible to trip the chime *after* determining if we're in night shutoff or not
* Reenable rotary encoder with libraries with workable licenses
* In display code, consider using `delayMicroseconds()` which, with its tighter resolution, may give better control over fades and dim levels
* in `checkInputs()`, can all this if/else business be defined at load instead of evaluated every sample? OR is it compiled that way? maybe use `#ifdef`
* in `ctrlEvt()`, could we do release/shorthold on mainSel so we can exit without making changes?
* Should functions be modular in the code, and have a reserved memory location / 100 per each?
* Should functions have their own options menu?
* I2C display to help with setting?
* I2C multicolor LED to indicate which function we're in?
* Metronome function
* Alarm option should be beeping patterns, including a slow wake which defeats the 2 minute delay
* Signalstart should create a situation where there's time on the counter, but doesn't make sound since the rtc can do that. Other beepable actions would probably cancel that counter anyway
* I2C multicolor LED to indicate which function we're in? - possibly as part of display
* Metronome function?
* Signalstart should create a situation where there's time on the counter, but doesn't make sound since the rtc can do that. Other beepable actions would probably cancel that counter anyway (is this still applicable?)
* Why does the display flicker sometimes? are we doubling up on a display cycle call?

See other TODOs throughout code.
81 changes: 81 additions & 0 deletions arduino-clock/arduino-clock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#ifndef ARDUINO_CLOCK_H
#define ARDUINO_CLOCK_H

////////// Hardware configuration //////////
//Include the config file that matches your hardware setup. If needed, duplicate an existing one.

#include "configs/undb-v9.h"

////////////////////////////////////////////


//Unique IDs for the functions - see also fnScroll
#define FN_TOD 0 //time of day
#define FN_CAL 1 //date, with optional day counter and sunrise/sunset pages
#define FN_ALARM 2 //alarm time
#define FN_TIMER 3 //countdown timer and chronograph
#define FN_THERM 4 //temperature per rtc – will likely read high
#define FN_TUBETEST 5 //simply cycles all digits for nixie tube testing
#define FN_OPTS 201 //fn values from here to 255 correspond to settings in the settings menu

void setup();
void loop();
void ctrlEvt(byte ctrl, byte evt, byte evtLast, bool velocity=0);
void fnScroll(byte dir);
void fnOptScroll(byte dir);
void goToFn(byte thefn, byte thefnPg=0);
void switchAlarmState(byte dir);
void setAlarmState(byte state);
byte getAlarmState();
void switchPower(byte dir);
void startSet(int n, int m, int x, byte p);
void doSet(int delta);
void clearSet();
bool initEEPROM(bool hard);
void findFnAndPageNumbers();
void checkRTC(bool force);
void fibonacci(byte h, byte m, byte s);
void autoDST();
bool isDST(int y, byte m, byte d);
bool isDSTByHour(int y, byte m, byte d, byte h, bool setFlag);
byte nthSunday(int y, byte m, byte nth);
byte daysInMonth(word y, byte m);
int daysInYear(word y);
int dateToDayCount(word y, byte m, byte d);
byte dayOfWeek(word y, byte m, byte d);
int dateComp(int y, byte m, byte d, byte mt, byte dt, bool countUp);
bool isTimeInRange(word tstart, word tend, word ttest);
bool isDayInRange(byte dstart, byte dend, byte dtest);
void millisCheckDrift();
void millisApplyDrift();
void millisReset();
unsigned long ms();
void timerStart();
void timerStop();
void timerClear();
void timerLap();
void timerRunoutToggle();
void cycleTimer();
void timerSleepSwitch(bool on);
byte getTimerState();
void setTimerState(char pos, bool val);
void tempDisplay(int i0, int i1=0, int i2=0, int i3=0);
void updateDisplay();
void calcSun();
void displaySun(byte which, int d, int tod);
void displayWeather(byte which);
void initOutputs();
void signalStart(byte sigFn, byte sigDur);
void signalStop();
void cycleSignal();
word getSignalPitch();
word getHz(byte note);
byte getSignalOutput();
byte getSignalPattern();
void quickBeep(int pitch);
void quickBeepPattern(int source, int pattern);
void updateBacklight();
void cycleBacklight();
byte getVersionPart(byte part);

#endif //ARDUINO_CLOCK_H
Loading

0 comments on commit 91c14f4

Please sign in to comment.