2018-11-26 11:58:15 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the "bluetoothheater" distribution
|
|
|
|
* (https://gitlab.com/mrjones.id.au/bluetoothheater)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Ray Jones <ray@mrjones.id.au>
|
|
|
|
* Copyright (C) 2018 James Clark
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-05-20 12:09:59 +00:00
|
|
|
#ifndef __BTC_HELPERS_H__
|
|
|
|
#define __BTC_HELPERS_H__
|
|
|
|
|
2018-12-15 09:34:58 +00:00
|
|
|
#include "Protocol.h"
|
2019-06-02 20:34:45 +00:00
|
|
|
#include "../Utility/UtilClasses.h"
|
2018-12-08 12:25:53 +00:00
|
|
|
|
2019-06-04 20:15:12 +00:00
|
|
|
struct sGPIO;
|
|
|
|
|
2018-12-01 00:36:25 +00:00
|
|
|
|
2018-12-15 09:34:58 +00:00
|
|
|
extern void ToggleOnOff();
|
|
|
|
extern void requestOn();
|
|
|
|
extern void requestOff();
|
2018-12-20 04:19:59 +00:00
|
|
|
extern bool reqTempDelta(int delta);
|
|
|
|
extern bool reqTemp(unsigned char newTemp);
|
|
|
|
extern bool reqThermoToggle();
|
|
|
|
extern bool setThermostatMode(unsigned char);
|
2019-03-14 10:52:59 +00:00
|
|
|
extern bool getThermostatModeActive(); // OEM: actual mode from blue wire, BTC: or our NV
|
2018-12-15 09:34:58 +00:00
|
|
|
extern void reqPumpPrime(bool on);
|
2019-03-14 10:52:59 +00:00
|
|
|
float getTemperatureDesired(); // OEM: the advertised value, BTC our setpoint
|
|
|
|
extern float getTemperatureSensor();
|
2018-12-15 09:34:58 +00:00
|
|
|
extern int getSetTemp();
|
2018-11-28 11:15:23 +00:00
|
|
|
extern void setPumpMin(float);
|
|
|
|
extern void setPumpMax(float);
|
|
|
|
extern void setFanMin(short);
|
|
|
|
extern void setFanMax(short);
|
2019-01-11 05:40:25 +00:00
|
|
|
extern void setFanSensor(unsigned char cVal);
|
2018-12-15 09:34:58 +00:00
|
|
|
extern void setDateTime(const char* newTime);
|
|
|
|
extern void setDate(const char* newTime);
|
|
|
|
extern void setTime(const char* newTime);
|
2019-01-19 11:05:14 +00:00
|
|
|
extern void setGlowDrive(unsigned char val);
|
2018-11-29 11:11:50 +00:00
|
|
|
extern void saveNV();
|
2019-01-11 05:40:25 +00:00
|
|
|
extern void setSystemVoltage(float val);
|
2018-12-01 00:36:25 +00:00
|
|
|
extern const CProtocolPackage& getHeaterInfo();
|
2019-04-19 11:38:39 +00:00
|
|
|
extern void interpretJsonCommand(char* pLine);
|
|
|
|
extern void resetWebModerator();
|
|
|
|
extern void resetJSONmoderator();
|
2018-12-20 22:22:29 +00:00
|
|
|
extern const char* getBlueWireStatStr();
|
2019-04-19 11:38:39 +00:00
|
|
|
extern bool hasOEMcontroller();
|
|
|
|
extern bool hasOEMLCDcontroller();
|
|
|
|
extern int getBlueWireStat();
|
|
|
|
extern int getSmartError();
|
|
|
|
extern bool isCyclicActive();
|
|
|
|
extern float getVersion();
|
2019-04-28 10:23:11 +00:00
|
|
|
const char* getVersionStr();
|
2019-04-19 11:38:39 +00:00
|
|
|
extern const char* getVersionDate();
|
|
|
|
extern int getBoardRevision();
|
|
|
|
extern void setupGPIO();
|
2019-06-02 12:47:35 +00:00
|
|
|
extern void setGPIOout(int channel, bool state);
|
|
|
|
extern bool getGPIOout(int channel);
|
|
|
|
extern bool toggleGPIOout(int channel);
|
2019-05-18 08:49:22 +00:00
|
|
|
extern void feedWatchdog();
|
2019-05-20 12:09:59 +00:00
|
|
|
extern bool isUpdateAvailable(bool test=true);
|
|
|
|
extern void checkFOTA();
|
2019-06-02 12:47:35 +00:00
|
|
|
extern void setUploadSize(long val);
|
2019-06-04 20:15:12 +00:00
|
|
|
extern void getGPIOinfo(sGPIO& info);
|
|
|
|
extern void simulateGPIOin(uint8_t newKey);
|
2019-05-20 12:09:59 +00:00
|
|
|
|
2019-04-04 10:48:05 +00:00
|
|
|
|
2019-06-02 20:34:45 +00:00
|
|
|
extern void ShowOTAScreen(int percent=0, eOTAmodes updateType=eOTAnormal);
|
|
|
|
|
|
|
|
|
2019-04-04 10:48:05 +00:00
|
|
|
|
2018-11-24 11:03:47 +00:00
|
|
|
|
2019-01-19 11:05:14 +00:00
|
|
|
#define LOWERLIMIT(A, B) if((A) < (B)) (A) = (B)
|
|
|
|
#define UPPERLIMIT(A, B) if((A) > (B)) (A) = (B)
|
2019-06-02 12:47:35 +00:00
|
|
|
#define WRAPUPPERLIMIT(A, B, C) if((A) > (B)) (A) = (C)
|
|
|
|
#define WRAPLOWERLIMIT(A, B, C) if((A) < (B)) (A) = (C)
|
|
|
|
#define WRAPLIMITS(A, B, C) if((A) < (B)) (A) = (C) ; if((A) > (C)) (A) = (B)
|
2019-05-20 12:09:59 +00:00
|
|
|
|
|
|
|
#endif
|