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

web-this/boiler/web-boiler-query.c

Committer:
andrewboyson
Date:
2021-02-23
Revision:
105:1899f7ed17ec
Parent:
104:46ce1aaf8be7
Child:
106:41ed3ea0bbba

File content as of revision 105:1899f7ed17ec:

#include <stdlib.h>
#include <string.h>
#include "http.h"
#include "boiler.h"

void WebBoilerQuery(char* pQuery)
{
    while (pQuery)
    {
        char* pName;
        char* pValue;
        pQuery = HttpQuerySplit(pQuery, &pName, &pValue);
        
        
        if (HttpSameStr(pName, "boilercallenable"))
        {
            BoilerCallEnable = !BoilerCallEnable;
        }
        
        if (HttpSameStr(pName, "fullspeedsecs"  ))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetFullSpeedSecs(value);
            return;
        }
        if (HttpSameStr(pName, "tanksetpoint"  ))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetTankSetPoint(value);
            return;
        }
        if (HttpSameStr(pName, "tankhysteresis"))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetTankHysteresis(value);
            return;
        }
        if (HttpSameStr(pName, "boilerresidual"))
        {
            double value = HttpQueryValueAsDouble(pValue);
            BoilerSetRunOnDeltaT((int)(value * 16));
            return;
        }
        if (HttpSameStr(pName, "boilerrunon"   ))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetRunOnTime(value);
            return;
        }
        if (HttpSameStr(pName, "pumpspeedcalling"))
        {
            if (!pValue) return;
            switch (pValue[0])
            {
                case  0 : return;
                case 'a':
                case 'A': BoilerSetPumpSpeedCalling(-1); return;
                case 't':
                case 'T': BoilerSetPumpSpeedCalling(-2); return;
            }
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetPumpSpeedCalling(value);
            return;
        }
        if (HttpSameStr(pName, "pumpspeedrunon"))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetPumpSpeedRunOn(value);
            return;
        }
        if (HttpSameStr(pName, "boileroutputtarget"))
        {
            int value = HttpQueryValueAsInt(pValue);
            BoilerSetOutputTarget(value);
            return;
        }
        if (HttpSameStr(pName, "blrriseat0"))
        {
            double value = HttpQueryValueAsDouble(pValue);
            BoilerSetMinimumFlow(value);
            return;
        }
        if (HttpSameStr(pName, "blrriseat50"))
        {
            double value = HttpQueryValueAsDouble(pValue);
            BoilerSetMidFlowSpeed(value);
            return;
        }
        if (HttpSameStr(pName, "blrriseat100"))
        {
            double value = HttpQueryValueAsDouble(pValue);
            BoilerSetFullSpeedDeltaT((int)(value * 16));
            return;
        }
    }
}