Compare commits
4 Commits
858ebac086
...
c0ec93c184
| Author | SHA1 | Date | |
|---|---|---|---|
|
c0ec93c184
|
|||
|
5072d09682
|
|||
|
72a37df703
|
|||
|
bf48a7765f
|
@ -137,10 +137,10 @@ void clockUpdate() {
|
|||||||
ts += UPDATE_INTERVAL_S;
|
ts += UPDATE_INTERVAL_S;
|
||||||
|
|
||||||
/* drift determined experimentally:
|
/* drift determined experimentally:
|
||||||
* ~3.5 ms "calculation time" per cycle
|
* ~3.5ms/cycle "calculation time"
|
||||||
* ~12.6ms/s aka 63.6ms/cycle other drift (wakeup time?)
|
* 60ms/cycle other drift (wakeup time?)
|
||||||
*/
|
*/
|
||||||
#define DRIFT_MS 65
|
#define DRIFT_MS 63
|
||||||
#define SCHEDULE_DELAY_MS ((1000 * UPDATE_INTERVAL_S) - DRIFT_MS)
|
#define SCHEDULE_DELAY_MS ((1000 * UPDATE_INTERVAL_S) - DRIFT_MS)
|
||||||
scheduler.scheduleDelayed(clockUpdate, SCHEDULE_DELAY_MS);
|
scheduler.scheduleDelayed(clockUpdate, SCHEDULE_DELAY_MS);
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ void loop() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
ts = 1618048100L;
|
ts = 1618651100L;
|
||||||
|
|
||||||
scheduler.execute();
|
scheduler.execute();
|
||||||
|
|
||||||
|
|||||||
18
Makefile
Normal file
18
Makefile
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
CC = clang
|
||||||
|
|
||||||
|
LIBS = -lm
|
||||||
|
|
||||||
|
x86:
|
||||||
|
$(CC) $(LIBS) klock4_x86.c -o klock4-x86
|
||||||
|
|
||||||
|
uc:
|
||||||
|
$(CC) $(LIBS) klock4_uc.c -o klock4-uc
|
||||||
|
|
||||||
|
wasm:
|
||||||
|
mkdir -p html_out
|
||||||
|
emcc klock4_wasm.c -s WASM=1 -o html_out/klock4.html --shell-file html_template/shell_minimal.html
|
||||||
|
|
||||||
|
all: x86 uc wasm
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf klock4-x86 klock4-uc html_out
|
||||||
@ -80,7 +80,9 @@ void settime(time_t ts) {
|
|||||||
float fminute = (float) minute + (float) second / 60;
|
float fminute = (float) minute + (float) second / 60;
|
||||||
minute = 5 * (unsigned int) roundf(fminute / 5);
|
minute = 5 * (unsigned int) roundf(fminute / 5);
|
||||||
|
|
||||||
unsigned int hour = (ts / (60*60) + 1) % 12;
|
unsigned int timezone = 1;
|
||||||
|
unsigned int daylight_savings = 1;
|
||||||
|
unsigned int hour = (ts / (60*60) + timezone + daylight_savings) % 12;
|
||||||
|
|
||||||
//printf("%02d:%02d\n", hour, minute);
|
//printf("%02d:%02d\n", hour, minute);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user