EVOG2-Spiffs-Avery/Parms_ADI.h

269 lines
10 KiB
C++

#ifndef Parms_ADI
#define Parms_ADI 1
#define PARMSIZE 140
int32_t parm[PARMSIZE];
int32_t tempParm[PARMSIZE]; // used to store parms of slave unit
int32_t remoteParm[PARMSIZE];
const int32_t parmlimits[][6] = // default, min, max, 1 = allow-default, 1 = needs-unlock-code
{
{0, 0, 2653999, 0, 0, 0}, // 0 Checksum
{0, 0, 2653999, 1, 0, 0}, // 1 Adnet address 0 = single door master, 100 = slave
{10, 0, 100, 1, 0, 0}, // 2 Gasket Delay
{10, 0, 10000, 1, 0, 0}, // 3 Bug Screen Button Time seconds * 10
{1, 0, 10000, 1, 0, 0}, // 4 Use Obstruction Sensor
{600, 0, 10000, 1, 0, 0}, // 5 Door Open Travel Timeout
{600, 1, 10000, 1, 0, 0}, // 6 Door Close Jog Limit -time from open to hit upper switch
{-6, -12, 12, 1, 0, 0}, // 7 Time Zone
{0, 0, 10000, 1, 0, 0}, // 8 Security Code Access
{0, 0, 1, 1, 0, 0}, // 9 Enable WiFi
{115, 0, 10000, 1, 0, 0}, // 10 Lo Battery voltage *10 / 0 = off
{0, 0, 10000, 0, 0, 0}, // 11 Open counter
{0, 0, 100000, 1, 0, 0}, // 12 auto setup script
{0, 0, 10000, 1, 0, 0}, // 13 0 = 2.4" Display, 1 = 5" Display
{0, 0, 10000, 0, 1, 0}, // 14 Store FIRMWARE Version Here
{1, 0, 15, 1, 0, 0}, // 15 bug screen channel
{0, 0, 10000, 1, 0, 0}, // 16 use SPARE relay for lock circuit ENERGIZE to UNLOCK
{1, 0, 10000, 1, 0, 0}, // 17
{1253, 0, 10000, 1, 0, 0}, // 18 batteryvoltage cal
{0, 0, 10000, 1, 0, 0}, // 19 number of 5" displays at address 181+
{0, 0, 10000, 1, 0, 0}, // 20 number of 2" displays at address 191+
{0, 0, 10000, 1, 0, 0}, // 21 number of motor controls at address 200+
{5, 1, 10000, 1, 0, 0}, // 22 WiFi service timer
{800, 200, 10000, 1, 0, 0}, // 23 WiFi Update timer
{0, 0, 10000, 0, 0, 0}, // 24 set to 1 to use NC interlock on spare 1
{0, 0, 2, 1, 0, 0}, // 25 #io expanders
{0, 0, 10000, 1, 0, 0}, // 26 ioExpander #0 remote open/close button mode -optos 0 and 1
{190, 0, 240, 1, 0, 0}, // 27 motor max current * 10
{0, 0, 10000, 1, 0, 538}, // 28 use ioExpander relays for Somfy screen control
{0, 0, 10000, 1, 0, 538}, // 29 splash screen timeout to blank screen 0 = off 1 = on
{30, 20, 10000, 1, 0, 538}, // 30 timeout for start motor
{10, 5, 10000, 1, 0, 538}, // 31 timeout for running motor
{0, 0, 10000, 1, 0, 0}, // 32
{0, 0, 20000, 1, 0, 0}, // 33 time between cycles for exercise mode / seconds * 10
{0, 0, 10000, 1, 0, 0}, // 34
{0, 0, 10000, 1, 0, 0}, // 35
{0, 0, 10000, 1, 0, 0}, // 36
{0, 0, 10000, 1, 0, 0}, // 37
{0, 0, 10000, 1, 0, 0}, // 38
{10, 0, 10000, 1, 0, 0}, // 39 Learned close position
{2000, 100, 10000, 1, 0, 0}, // 40 Learned open position
{5, 0, 10000, 1, 0, 0}, // 41 SYNC Inteval
{100, 0, 10000, 1, 0, 0}, // 42 SYNC Integral
{50, 0, 10000, 1, 0, 0}, // 43 SYNC Proportional
{200, 0, 10000, 1, 0, 0}, // 44 MAX_DELTA
{250, 0, 10000, 1, 0, 0}, // 45 MAX_CURRENT
{50, 0, 10000, 1, 0, 0}, // 46 MOTOR_SPEED
{3000, 0, 10000, 1, 0, 0}, // 47 EXTEND_LIMIT
{0, -10000, 10000, 1, 0, 0}, // 48 SLAVE OFFSET
{0, -1000, 1000, 1, 0, 0}, // 49 setCurrentBalance open
{0, -1000, 1000, 1, 0, 0}, // 50 setCurrentBalance close
{0, 0, 10000, 1, 0, 0}, // 51
{0, 0, 10000, 1, 0, 538}, // 52 number of slaves
{0, 0, 10000, 1, 0, 0}, // 53
{0, 0, 10000, 1, 0, 0}, // 54 Use Lidar
{0, 0, 10000, 1, 0, 0}, // 55 Lidar parm 2 door height
{0, 0, 10000, 1, 0, 0}, // 56 Lidar parm 3 door width
{0, 0, 10000, 1, 0, 0}, // 57 Lidar parm 4 deadband
{5, 0, 10000, 1, 0, 0}, // 58 Lidar parm 5 debounce count
{0, 0, 10000, 1, 0, 0}, // 59 Lidar parm 6 mounting angle
{0, 0, 10000, 1, 0, 0}, // 60 Lidar parm 7 run mode
{0, 0, 10000, 1, 0, 0}, // 61
{0, 0, 10000, 1, 0, 0}, // 62
{0, 0, 10000, 1, 0, 0}, // 63
{2002, 3, 9000000, 0, 1, 0}, // 64 serial# stored here.. not included in factory default set
{400, 0, 10000, 1, 0, 0}, // 65 Lidar down from open deadband
{300, 0, 10000, 1, 0, 0}, // 66 Lidar up from closed deadband
{0, 0, 10000, 1, 0, 538}, // 67 splash screen timeout to blank screen 0 = off 1 = on
{0, 0, 10000, 1, 0, 0}, // 68
{0, 0, 999999999, 1, 0, 0}, // 69 temp storage of last rtc set
{0, 0, 999999999, 1, 0, 0}, // 70
{0, 0, 999999999, 1, 0, 0}, // 71
{0, 0, 999999999, 1, 0, 0}, // 72
{0, 0, 999999999, 1, 0, 0}, // 73
{0, 0, 999999999, 1, 0, 0}, // 74
{1, 1, 1, 1, 0, 0}, // 75 Device type
{0, 0, 2147000000, 1, 0, 0}, // 76 Last Service time
{0, 0, 999999999, 1, 0, 0}, // 77
{0, 0, 999999999, 1, 0, 0}, // 78
{0, 0, 999999999, 1, 0, 0}, // 79
{0, 0, 999999999, 1, 0, 0}, // 80
{0, 0, 999999999, 1, 0, 0}, // 81
{0, 0, 999999999, 1, 0, 0}, // 82
{0, 0, 999999999, 1, 0, 0}, // 83
{0, 0, 999999999, 1, 0, 0}, // 84
{0, 0, 999999999, 1, 0, 0}, // 85
{0, 0, 999999999, 1, 0, 0}, // 86
{0, 0, 999999999, 1, 0, 0}, // 87
{0, 0, 999999999, 1, 0, 0}, // 88
{0, 0, 999999999, 1, 0, 0}, // 89
{0, 0, 999999999, 1, 0, 0}, // 90
{0, 0, 999999999, 1, 0, 0}, // 91
{0, 0, 999999999, 1, 0, 0}, // 92
{0, 0, 999999999, 1, 0, 0}, // 93
{0, 0, 999999999, 1, 0, 0}, // 94
{0, 0, 999999999, 1, 0, 0}, // 95
{0, 0, 999999999, 1, 0, 0}, // 96
{0, 0, 999999999, 1, 0, 0}, // 97
{0, 0, 999999999, 1, 0, 0}, // 98
{0, 0, 999999999, 1, 0, 0}, // 99
{0, 0, 999999999, 1, 0, 0}, // 100
{10, 0, 500, 1, 0, 0}, // 101 Clarity advertising repeat count v534
{0, 0, 999999999, 1, 0, 0}, // 102
{0, 0, 999999999, 1, 0, 0}, // 103
{0, 0, 999999999, 1, 0, 0}, // 104
{0, 0, 999999999, 1, 0, 0}, // 105
{0, 0, 999999999, 1, 0, 0}, // 106
{0, 0, 999999999, 1, 0, 0}, // 107
{0, 0, 999999999, 1, 0, 0}, // 108
{0, 0, 999999999, 1, 0, 0}, // 109
{0, 0, 999999999, 1, 0, 0}, // 110
{0, 0, 999999999, 1, 0, 0}, // 111
{0, 0, 999999999, 1, 0, 0}, // 112
{0, 0, 999999999, 1, 0, 0}, // 113
{0, 0, 999999999, 1, 0, 0}, // 114
{0, 0, 999999999, 1, 0, 0}, // 115
{0, 0, 999999999, 1, 0, 0}, // 116
{0, 0, 999999999, 1, 0, 0}, // 117
{0, 0, 999999999, 1, 0, 0}, // 118
{0, 0, 999999999, 1, 0, 0}, // 119
{0, 0, 999999999, 1, 0, 0}, // 120
{0, 0, 999999999, 1, 0, 0}, // 121
{0, 0, 999999999, 1, 0, 0}, // 122
{0, 0, 999999999, 1, 0, 0}, // 123
{0, 0, 999999999, 1, 0, 0}, // 124
{0, 0, 999999999, 1, 0, 0}, // 125
{0, 0, 999999999, 1, 0, 0}, // 126
{0, 0, 999999999, 1, 0, 0}, // 127
{0, 0, 999999999, 1, 0, 0}, // 128
{0, 0, 999999999, 1, 0, 0}, // 129
{0, 0, 999999999, 1, 0, 0}, // 130
{0, 0, 999999999, 1, 0, 0}, // 131
{0, 0, 999999999, 1, 0, 0}, // 132
{0, 0, 999999999, 1, 0, 0}, // 133
{0, 0, 999999999, 1, 0, 0}, // 134
{0, 0, 999999999, 1, 0, 0}, // 135
{0, 0, 999999999, 1, 0, 0}, // 136
{0, 0, 999999999, 1, 0, 0}, // 137
{0, 0, 999999999, 1, 0, 0}, // 138
{0, 0, 999999999, 1, 0, 0}, // 139
};
#endif
/*
if 255, factory default,
// if 19315, set serial to parm 22
// if 6911, set RLY08 at address 1 to parm 22 valid numbers are 2-4
// if 257, ssid = ADITEST, pass = 12345678
// if 6011, OTA
// if 6013, Sensor screen
// if 6012, Timer screen
// if 6014, Toggle VB
*/
#ifndef PARMS_LIB_H
#define PARMS_LIB_H
#include "FileLib.h"
class ParmsLibClass
{
private:
/**
* File system
*/
FileLibClass &_fileLib;
/**
* Verbose mode flag
*/
bool _verbose = false;
/**
* Qualify a single parm
* @param pnum Index of the parm to qualify
* @param pdat Value to qualify
*
* @return true if parm is valid
*/
bool _qualify(uint16_t pnum, int32_t pdat);
/**
* Qualify all parms and set parm to default if invalid
*/
void _qualifyAll(void);
/**
* Print out message, if verbose mode is enabled
*/
void _printMessage(const char *message, ...);
/**
* Calculate the checksum
*
* @return Checksum value
*/
int32_t _calcChecksum(void);
public:
/**
* Constructor
*/
ParmsLibClass(FileLibClass &fileLib) : _fileLib(fileLib){};
/**
* Destructor
*/
~ParmsLibClass();
/**
* Set verbose mode
* @param verbose true to enable verbose mode
*/
void setVerbose(bool verbose) { _verbose = verbose; }
/**
* Read parm
* @param pnum Index of the parm to read
*
* @returns Value at the parm index
*/
int32_t read(uint16_t pnum);
/**
* Write parm
* @param pnum Index of the parm to write
* @param pdat Value to write
*
* @return true if successful
*/
bool write(uint16_t pnum, int32_t pdat);
/**
* Set factory parms
*/
void factoryReset(void);
/**
* Read from FS
* @param filename Optional, default "/PARMS.ADI". Filename to write to.
*
* @return true if successful
*/
bool loadFromFS(char *filename = "/PARMS.ADI");
/**
* Write to FS
* @param filename Optional, default "/PARMS.ADI". Filename to write to.
*
* @return true if successful
*/
bool saveToFS(char *filename = "/PARMS.ADI");
};
#endif