Compare commits

..

4 Commits

Author SHA1 Message Date
c0ec93c184 Add Makefile 2021-04-21 15:34:38 +02:00
5072d09682 Update drift compensation in ino version 2021-04-21 15:34:24 +02:00
72a37df703 Update timezone in wasm version 2021-04-21 15:33:59 +02:00
bf48a7765f Rename x86 version 2021-04-21 15:33:47 +02:00
4 changed files with 25 additions and 5 deletions

View File

@ -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
View 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

View File

@ -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);