Allows my home wiz lights to be timed on and off according to a schedule.
web/web-wiz-ajax.c@7:3035a540ef65, 2021-06-09 (annotated)
- Committer:
- andrewboyson
- Date:
- Wed Jun 09 09:23:54 2021 +0000
- Revision:
- 7:3035a540ef65
- Parent:
- 5:ec0498d7d2c1
Changed WizSchedMinutesUtcToLocal function so that local midnight in summer is 00h00 rather than 24h00.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 0:9af80a39adcc | 1 | #include <stdint.h> |
andrewboyson | 0:9af80a39adcc | 2 | #include <stdio.h> |
andrewboyson | 0:9af80a39adcc | 3 | #include <time.h> |
andrewboyson | 0:9af80a39adcc | 4 | |
andrewboyson | 0:9af80a39adcc | 5 | #include "http.h" |
andrewboyson | 0:9af80a39adcc | 6 | #include "wiz.h" |
andrewboyson | 0:9af80a39adcc | 7 | #include "wiz-sun.h" |
andrewboyson | 0:9af80a39adcc | 8 | #include "wiz-sched.h" |
andrewboyson | 0:9af80a39adcc | 9 | #include "wiz-list.h" |
andrewboyson | 0:9af80a39adcc | 10 | #include "clk.h" |
andrewboyson | 0:9af80a39adcc | 11 | |
andrewboyson | 0:9af80a39adcc | 12 | void WebWizAjax() |
andrewboyson | 0:9af80a39adcc | 13 | { |
andrewboyson | 0:9af80a39adcc | 14 | HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL); |
andrewboyson | 0:9af80a39adcc | 15 | |
andrewboyson | 0:9af80a39adcc | 16 | HttpAddNibbleAsHex(WizTrace); |
andrewboyson | 0:9af80a39adcc | 17 | HttpAddChar('\n'); |
andrewboyson | 0:9af80a39adcc | 18 | HttpAddChar('\f'); |
andrewboyson | 0:9af80a39adcc | 19 | WizListHttp(); |
andrewboyson | 0:9af80a39adcc | 20 | HttpAddChar('\f'); |
andrewboyson | 0:9af80a39adcc | 21 | |
andrewboyson | 0:9af80a39adcc | 22 | struct tm tmUtc; |
andrewboyson | 0:9af80a39adcc | 23 | ClkNowTmUtc (&tmUtc); |
andrewboyson | 0:9af80a39adcc | 24 | |
andrewboyson | 0:9af80a39adcc | 25 | int minutesTodayUtc = tmUtc.tm_hour * 60 + tmUtc.tm_min; |
andrewboyson | 0:9af80a39adcc | 26 | |
andrewboyson | 5:ec0498d7d2c1 | 27 | HttpAddInt32AsHex(WizSchedMinutesUtcToLocal(minutesTodayUtc)); |
andrewboyson | 0:9af80a39adcc | 28 | HttpAddChar('\n'); |
andrewboyson | 0:9af80a39adcc | 29 | HttpAddInt32AsHex(minutesTodayUtc); |
andrewboyson | 0:9af80a39adcc | 30 | HttpAddChar('\n'); |
andrewboyson | 5:ec0498d7d2c1 | 31 | HttpAddInt32AsHex(WizSchedMinutesUtcToLocal(WizSunRiseMinutes())); |
andrewboyson | 0:9af80a39adcc | 32 | HttpAddChar('\n'); |
andrewboyson | 5:ec0498d7d2c1 | 33 | HttpAddInt32AsHex(WizSchedMinutesUtcToLocal(WizSunSetMinutes())); |
andrewboyson | 0:9af80a39adcc | 34 | HttpAddChar('\n'); |
andrewboyson | 0:9af80a39adcc | 35 | HttpAddChar('\f'); |
andrewboyson | 0:9af80a39adcc | 36 | |
andrewboyson | 0:9af80a39adcc | 37 | WizSchedHttp(); |
andrewboyson | 0:9af80a39adcc | 38 | } |
andrewboyson | 0:9af80a39adcc | 39 |