Central Heating controller using the real time clock, PHY module for internet, 1-wire interface for temperature sensors, a system log and a configuration file

Dependencies:   net 1-wire lpc1768 crypto clock web fram log

/media/uploads/andrewboyson/heating.sch

/media/uploads/andrewboyson/heating.brd

/media/uploads/andrewboyson/eagle.epf

Revision:
48:6eac12df3ad5
Parent:
47:229338b3adcb
Child:
95:97621bfbedfa
--- a/heating/program.c	Tue Apr 23 18:47:47 2019 +0000
+++ b/heating/program.c	Fri Apr 26 16:40:19 2019 +0000
@@ -7,9 +7,9 @@
 #include  "clk.h"
 #include  "log.h"
 #include "fram.h"
-#include "program.h"
+#include "http.h"
 
-#define PROGRAMS_COUNT            3
+#define PROGRAMS_COUNT    3
 #define TRANSITIONS_COUNT 4
 static int16_t programs[PROGRAMS_COUNT][TRANSITIONS_COUNT]; static int iPrograms;
 static char    programDay[7];                               static int iDay;
@@ -110,6 +110,32 @@
     }
     *p = 0;
 }
+void ProgramSendAjax()
+{
+    for (int program = 0; program < PROGRAMS_COUNT; program++)
+    {
+        for (int transition = 0; transition < TRANSITIONS_COUNT; transition++)
+        {
+            bool  inuse;
+            bool  on;
+            int   minuteUnits;
+            decodeTransition(programs[program][transition], &inuse, &on, &minuteUnits);
+            if (!inuse) continue;
+            
+            int minuteTens  = minuteUnits / 10; minuteUnits %= 10;
+            int   hourUnits = minuteTens  /  6; minuteTens  %=  6;
+            int   hourTens  =   hourUnits / 10;   hourUnits %= 10;
+            
+            if (transition) HttpAddChar(' ');
+            HttpAddChar(on ? '+' : '-');
+            HttpAddChar(hourTens    + '0');
+            HttpAddChar(hourUnits   + '0');
+            HttpAddChar(minuteTens  + '0');
+            HttpAddChar(minuteUnits + '0');
+        }
+        HttpAddChar('\n');
+    }
+}
 static void handleParseDelim(int program, int* pIndex, bool* pInUse, bool* pOn, int* pHourTens,  int* pHourUnits, int* pMinuteTens, int* pMinuteUnits)
 {
     int hour = *pHourTens * 10 + *pHourUnits;