Skip to content

Commit

Permalink
Pull my_ variables written to the JSON into a single struct (#528)
Browse files Browse the repository at this point in the history
* Update Globals.h

* Struct for JSON

my_ variables stored in the JSON collected into a single structure

* Up version
  • Loading branch information
thegreatgunbantoad authored Jul 30, 2021
1 parent 59023bf commit 01bcd8a
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 190 deletions.
38 changes: 35 additions & 3 deletions pio/lib/Globals/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
extern Ticker flasher;

// defines go here
#define FIRMWAREVERSION "7.1.0"
#define FIRMWAREVERSION "7.1.3"

#define API_FHEM true
#define API_UBIDOTS true
Expand All @@ -36,14 +36,17 @@ extern Ticker flasher;
#define API_AWSIOTMQTT true //AWS
#define API_BRICKS true


//#define BLYNK_DEBUG
//#define APP_DEBUG
//#define BLYNK_PRINT Serial
#define BLYNK_NO_BUILTIN
#define BLYNK_NO_FANCY_LOGO
#define BLYNK_MAX_SENDBYTES 1200

#define TEMP_CELSIUS 0
#define TEMP_FAHRENHEIT 1
#define TEMP_KELVIN 2

#ifndef DEBUG
#define DEBUG true
#endif
Expand Down Expand Up @@ -111,7 +114,7 @@ extern Ticker flasher;
// sleep management
#define RTCSLEEPADDR 5
#define MAXSLEEPTIME 3600UL //TODO
#define EMERGENCYSLEEP (my_sleeptime * 3 < MAXSLEEPTIME ? MAXSLEEPTIME : my_sleeptime * 3)
#define EMERGENCYSLEEP (myData.my_sleeptime * 3 < MAXSLEEPTIME ? MAXSLEEPTIME : myData.my_sleeptime * 3)
#define LOWBATT 3.3

#define UNINIT 0
Expand All @@ -128,4 +131,33 @@ extern void flash();
float scaleTemperature(float t);
String tempScaleLabel(void);

struct iData
{
char my_token[TKIDSIZE * 2];
char my_name[TKIDSIZE] = "iSpindel000";
char my_server[DNSSIZE];
char my_uri[DNSSIZE];
char my_db[TKIDSIZE] = "ispindel";
char my_username[TKIDSIZE];
char my_password[TKIDSIZE];
char my_job[TKIDSIZE] = "ispindel";
char my_instance[TKIDSIZE] = "000";
char my_polynominal[1000] = "-0.00031*tilt^2+0.557*tilt-14.054";
String my_ssid;
String my_psk;
uint8_t my_api;
uint32_t my_sleeptime = 15 * 60;
uint16_t my_port = 80;
uint32_t my_channel;
float my_vfact = ADCDIVISOR;
int16_t my_Offset[6];
uint8_t my_tempscale = TEMP_CELSIUS;
int8_t my_OWpin = -1;
#if API_MQTT_HASSIO
bool my_hassio = false;
#endif
};

extern iData myData;

#endif
Loading

0 comments on commit 01bcd8a

Please sign in to comment.