Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Committer:
andrewboyson
Date:
Mon Dec 31 18:49:36 2018 +0000
Revision:
15:2cea2bbd5046
Parent:
14:c3c43c8faf0e
Child:
19:598dd2145e84
Added information to the clock page

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 14:c3c43c8faf0e 1 #include <time.h>
andrewboyson 14:c3c43c8faf0e 2
andrewboyson 14:c3c43c8faf0e 3 #include "http.h"
andrewboyson 14:c3c43c8faf0e 4 #include "page.h"
andrewboyson 14:c3c43c8faf0e 5 #include "nav.h"
andrewboyson 14:c3c43c8faf0e 6 #include "http-base.h"
andrewboyson 14:c3c43c8faf0e 7 #include "clock.h"
andrewboyson 14:c3c43c8faf0e 8 #include "rtc.h"
andrewboyson 14:c3c43c8faf0e 9 #include "clkstate.h"
andrewboyson 14:c3c43c8faf0e 10 #include "scan.h"
andrewboyson 14:c3c43c8faf0e 11
andrewboyson 14:c3c43c8faf0e 12 void HttpClockHtml()
andrewboyson 14:c3c43c8faf0e 13 {
andrewboyson 14:c3c43c8faf0e 14 HttpOk("text/html; charset=UTF-8", "no-cache", NULL, NULL);
andrewboyson 14:c3c43c8faf0e 15 PageAddHeader(NavSite, "Clock", "settings.css", "clock.js");
andrewboyson 14:c3c43c8faf0e 16 NavAdd(CLOCK_PAGE);
andrewboyson 14:c3c43c8faf0e 17 PageAddH1(NavSite, "Clock");
andrewboyson 14:c3c43c8faf0e 18
andrewboyson 14:c3c43c8faf0e 19 PageAddH2("Sync status");
andrewboyson 15:2cea2bbd5046 20 PageAddAjaxToggle(10.0, "RTC is set" , "ajax-rtc-set" , "");
andrewboyson 15:2cea2bbd5046 21 PageAddAjaxToggle(10.0, "Clock is set" , "ajax-clock-set" , "");
andrewboyson 15:2cea2bbd5046 22 PageAddAjaxToggle(10.0, "External source is ok", "ajax-source-ok" , "");
andrewboyson 15:2cea2bbd5046 23 PageAddAjaxToggle(10.0, "Rate synchronised" , "ajax-rate-locked", "");
andrewboyson 15:2cea2bbd5046 24 PageAddAjaxToggle(10.0, "Time synchronised" , "ajax-time-locked", "");
andrewboyson 15:2cea2bbd5046 25
andrewboyson 15:2cea2bbd5046 26 PageAddH2("Server UTC time");
andrewboyson 15:2cea2bbd5046 27 HttpAddText("<div id='date-utc'></div>\r\n");
andrewboyson 14:c3c43c8faf0e 28
andrewboyson 14:c3c43c8faf0e 29 PageAddH2("Server local time");
andrewboyson 14:c3c43c8faf0e 30 HttpAddText("<div id='date-pc'></div>\r\n");
andrewboyson 14:c3c43c8faf0e 31
andrewboyson 14:c3c43c8faf0e 32 PageAddH2("Server - PC");
andrewboyson 14:c3c43c8faf0e 33 HttpAddText("<div id='date-diff'></div>\r\n");
andrewboyson 14:c3c43c8faf0e 34
andrewboyson 14:c3c43c8faf0e 35 PageAddH2("Leap seconds");
andrewboyson 14:c3c43c8faf0e 36 PageAddAjaxToggle(10.0, "Next leap enable" , "ajax-leap-enable" , "chg-clock-leap-enable" );
andrewboyson 14:c3c43c8faf0e 37 PageAddAjaxToggle(10.0, "Next leap backward" , "ajax-leap-backward", "chg-clock-leap-backward");
andrewboyson 14:c3c43c8faf0e 38 PageAddAjaxHex ( 6.0, "Next Year" , 5.2 , "ajax-leap-year" , "set-clock-leap-year" );
andrewboyson 14:c3c43c8faf0e 39 PageAddAjaxHex ( 6.0, "Next Month" , 5.2 , "ajax-leap-month" , "set-clock-leap-month" );
andrewboyson 14:c3c43c8faf0e 40 PageAddAjaxHex ( 6.0, "Count" , 5.2 , "ajax-leap-count" , "set-clock-leap-count" );
andrewboyson 14:c3c43c8faf0e 41
andrewboyson 14:c3c43c8faf0e 42 HttpAddText("<button type='button' onclick='DisplayLeap()'>Display Leap</button>\r\n");
andrewboyson 14:c3c43c8faf0e 43
andrewboyson 15:2cea2bbd5046 44 PageAddH2("Settings");
andrewboyson 15:2cea2bbd5046 45 PageAddIntInput ("/clock", 0, "Ppb", 12, "ppb", 5, ClockPpb );
andrewboyson 15:2cea2bbd5046 46 PageAddIntInput ("/clock", 0, "Ppb divisor", 12, "ppbdivisor", 5, ClockPpbDivisor );
andrewboyson 15:2cea2bbd5046 47 PageAddIntInput ("/clock", 0, "Ppb max change", 12, "ppbmaxchange", 5, ClockPpbChangeMax );
andrewboyson 15:2cea2bbd5046 48 PageAddIntInput ("/clock", 0, "Ppb synced limit", 12, "syncedlimitppb", 5, ClockSyncedLimitPpb );
andrewboyson 15:2cea2bbd5046 49 PageAddIntInput ("/clock", 0, "Ppb synced hysteresis", 12, "syncedhysppb", 5, ClockSyncedHysterisPpb );
andrewboyson 15:2cea2bbd5046 50
andrewboyson 15:2cea2bbd5046 51 PageAddIntInput ("/clock", 0, "Offset divisor", 12, "slewdivisor", 5, ClockSlewDivisor );
andrewboyson 15:2cea2bbd5046 52 PageAddIntInput ("/clock", 0, "Offset max (ms)", 12, "slewmax", 5, ClockSlewMaxMs );
andrewboyson 15:2cea2bbd5046 53 PageAddIntInput ("/clock", 0, "Offset synced limit (ms)",12, "syncedlimitns", 5, ClockSyncedLimitNs / 1000000 );
andrewboyson 15:2cea2bbd5046 54 PageAddIntInput ("/clock", 0, "Offset synced hys (ms)", 12, "syncedhysns", 5, ClockSyncedHysterisNs / 1000000 );
andrewboyson 15:2cea2bbd5046 55 PageAddIntInput ("/clock", 0, "Offset reset limit (s)", 12, "maxoffsetsecs", 5, ClockMaxOffsetSecs );
andrewboyson 15:2cea2bbd5046 56
andrewboyson 14:c3c43c8faf0e 57 PageAddH2("Scan times");
andrewboyson 14:c3c43c8faf0e 58 PageAddLabelledInt("Program cycles avg", 17, ScanAverage);
andrewboyson 14:c3c43c8faf0e 59 PageAddLabelledInt("Program cycles max", 17, ScanMaximum);
andrewboyson 14:c3c43c8faf0e 60 PageAddLabelledInt("Program cycles min", 17, ScanMinimum);
andrewboyson 14:c3c43c8faf0e 61
andrewboyson 15:2cea2bbd5046 62 PageAddH2("Ajax");
andrewboyson 15:2cea2bbd5046 63 HttpAddText("<code id='ajax-headers'></code>\r\n");
andrewboyson 15:2cea2bbd5046 64 HttpAddText("<code id='ajax-response'></code>\r\n");
andrewboyson 15:2cea2bbd5046 65
andrewboyson 14:c3c43c8faf0e 66 PageAddEnd();
andrewboyson 14:c3c43c8faf0e 67 }