Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Committer:
andrewboyson
Date:
Fri May 17 15:02:00 2019 +0000
Revision:
125:772948168e4f
Parent:
124:a2de6c22f85e
Updated net library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 110:8ab752842d25 1 #include <time.h>
andrewboyson 110:8ab752842d25 2
andrewboyson 110:8ab752842d25 3 #include "http.h"
andrewboyson 110:8ab752842d25 4 #include "web-nav-base.h"
andrewboyson 110:8ab752842d25 5 #include "web-add.h"
andrewboyson 110:8ab752842d25 6
andrewboyson 110:8ab752842d25 7 void WebClockHtml()
andrewboyson 110:8ab752842d25 8 {
andrewboyson 110:8ab752842d25 9 HttpOk("text/html; charset=UTF-8", "no-cache", NULL, NULL);
andrewboyson 110:8ab752842d25 10 WebAddHeader("Clock", "settings.css", "clock.js");
andrewboyson 110:8ab752842d25 11 WebAddNav(CLOCK_PAGE);
andrewboyson 110:8ab752842d25 12 WebAddH1("Clock");
andrewboyson 110:8ab752842d25 13
andrewboyson 110:8ab752842d25 14 WebAddH2("Status");
andrewboyson 110:8ab752842d25 15 WebAddAjaxLed("RTC is set" , "ajax-rtc-set" );
andrewboyson 110:8ab752842d25 16 WebAddAjaxLed("Clock is set" , "ajax-clock-set" );
andrewboyson 110:8ab752842d25 17 WebAddAjaxLed("External source is ok", "ajax-source-ok" );
andrewboyson 110:8ab752842d25 18 WebAddAjaxLed("Time synchronised" , "ajax-time-locked");
andrewboyson 110:8ab752842d25 19 WebAddAjaxLed("Rate synchronised" , "ajax-rate-locked");
andrewboyson 110:8ab752842d25 20
andrewboyson 110:8ab752842d25 21 WebAddH2("Server UTC time");
andrewboyson 110:8ab752842d25 22 HttpAddText("<div id='ajax-date-utc'></div>\r\n");
andrewboyson 110:8ab752842d25 23
andrewboyson 110:8ab752842d25 24 WebAddH2("Server local time");
andrewboyson 110:8ab752842d25 25 HttpAddText("<div id='ajax-date-pc'></div>\r\n");
andrewboyson 110:8ab752842d25 26
andrewboyson 110:8ab752842d25 27 WebAddH2("Server - PC (ms)");
andrewboyson 110:8ab752842d25 28 HttpAddText("<div id='ajax-date-diff'></div>\r\n");
andrewboyson 110:8ab752842d25 29
andrewboyson 110:8ab752842d25 30 WebAddH2("UTC");
andrewboyson 110:8ab752842d25 31 WebAddAjaxInputToggle("Enable epoch change" , "ajax-leap-enable" , "chg-clock-leap-enable" );
andrewboyson 110:8ab752842d25 32 WebAddAjaxInputToggle("Direction of next epoch" , "ajax-leap-forward" , "chg-clock-leap-forward");
andrewboyson 110:8ab752842d25 33 WebAddAjaxInput ("Year next epoch starts" , 4, "ajax-leap-year" , "set-clock-leap-year" );
andrewboyson 110:8ab752842d25 34 WebAddAjaxInput ("Month next epoch starts" , 4, "ajax-leap-month" , "set-clock-leap-month" );
andrewboyson 110:8ab752842d25 35 WebAddAjaxInput ("Current era offset" , 4, "ajax-leap-count" , "set-clock-leap-count" );
andrewboyson 110:8ab752842d25 36
andrewboyson 110:8ab752842d25 37 HttpAddText("<div><button type='button' onclick='displayLeap()'>Display leap</button></div>\r\n");
andrewboyson 110:8ab752842d25 38
andrewboyson 110:8ab752842d25 39 HttpAddText("<div>The leap seconds list is available <a href='https://www.ietf.org/timezones/data/leap-seconds.list' target='_blank'>here</a></div>\r\n");
andrewboyson 110:8ab752842d25 40
andrewboyson 124:a2de6c22f85e 41 WebAddH2("Governor");
andrewboyson 110:8ab752842d25 42 WebAddAjaxInput ("Ppb" , 5, "ajax-ppb" , "ppb" );
andrewboyson 110:8ab752842d25 43 WebAddAjaxInput ("Ppb divisor" , 5, "ajax-ppb-divisor" , "ppbdivisor" );
andrewboyson 110:8ab752842d25 44 WebAddAjaxInput ("Ppb max change" , 5, "ajax-ppb-max-chg" , "ppbmaxchange" );
andrewboyson 110:8ab752842d25 45 WebAddAjaxInput ("Ppb synced limit" , 5, "ajax-ppb-syn-lim" , "syncedlimitppb");
andrewboyson 110:8ab752842d25 46 WebAddAjaxInput ("Ppb synced hysteresis" , 5, "ajax-ppb-syn-hys" , "syncedhysppb" );
andrewboyson 110:8ab752842d25 47 WebAddAjaxInput ("Offset divisor" , 5, "ajax-off-divisor" , "slewdivisor" );
andrewboyson 110:8ab752842d25 48 WebAddAjaxInput ("Offset max (ms)" , 5, "ajax-off-max" , "slewmax" );
andrewboyson 110:8ab752842d25 49 WebAddAjaxInput ("Offset synced limit (ms)", 5, "ajax-off-syn-lim" , "syncedlimitns" );
andrewboyson 110:8ab752842d25 50 WebAddAjaxInput ("Offset synced hys (ms)" , 5, "ajax-off-syn-hys" , "syncedhysns" );
andrewboyson 110:8ab752842d25 51 WebAddAjaxInput ("Offset reset limit (s)" , 5, "ajax-off-rst-lim" , "maxoffsetsecs" );
andrewboyson 110:8ab752842d25 52 WebAddAjaxInputToggle("Trace" , "ajax-gov-trace" , "clockgovtrace" );
andrewboyson 110:8ab752842d25 53
andrewboyson 110:8ab752842d25 54 WebAddH2("NTP");
andrewboyson 110:8ab752842d25 55 WebAddAjaxInput ("Server url" , 5, "ajax-ntp-server" , "ntpserver" );
andrewboyson 110:8ab752842d25 56 WebAddAjaxInput ("Initial interval (s)" , 5, "ajax-ntp-initial" , "clockinitial" );
andrewboyson 110:8ab752842d25 57 WebAddAjaxInput ("Normal interval (m)" , 5, "ajax-ntp-normal" , "clocknormal" );
andrewboyson 110:8ab752842d25 58 WebAddAjaxInput ("Retry interval (s)" , 5, "ajax-ntp-retry" , "clockretry" );
andrewboyson 110:8ab752842d25 59 WebAddAjaxInput ("Offset (ms)" , 5, "ajax-ntp-offset" , "clockoffset" );
andrewboyson 110:8ab752842d25 60 WebAddAjaxInput ("Max delay (ms)" , 5, "ajax-ntp-max-delay", "clockmaxdelay" );
andrewboyson 110:8ab752842d25 61
andrewboyson 110:8ab752842d25 62 WebAddH2("Scan times");
andrewboyson 110:8ab752842d25 63 WebAddAjaxLabelled ("Program cycles avg", "ajax-scan-avg");
andrewboyson 110:8ab752842d25 64 WebAddAjaxLabelled ("Program cycles max", "ajax-scan-max");
andrewboyson 110:8ab752842d25 65 WebAddAjaxLabelled ("Program cycles min", "ajax-scan-min");
andrewboyson 110:8ab752842d25 66
andrewboyson 110:8ab752842d25 67 WebAddEnd();
andrewboyson 110:8ab752842d25 68 }