From 0aac8d5b66052274f67c7d2f21d4cea55dae502c Mon Sep 17 00:00:00 2001 From: AMRowsell Date: Sun, 7 Apr 2019 14:14:27 +0000 Subject: [PATCH] Revert "Merged updates from dev branch into master" This reverts commit dc724a2c9649234c4c202b6b821f71f9d76b99dd --- main.c | 11 +++++------ strtoarr.py | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 5a17640..719ef25 100644 --- a/main.c +++ b/main.c @@ -121,8 +121,8 @@ LOCAL void ICACHE_FLASH_ATTR dataLog(void *arg) { void ICACHE_FLASH_ATTR user_init() { LOCAL mqtt_session_t globalSession; LOCAL mqtt_session_t *pGlobalSession = &globalSession; - char passkey[64] = "yourwifipass"; char ssid[32] = "yourwifissid"; + char passkey[64] = "yourwifipass"; struct station_config stationConf; gpio_init(); // init gpio so we can use the LED & onewire bus @@ -137,15 +137,14 @@ void ICACHE_FLASH_ATTR user_init() { // prepare the TCP/MQTT connection stuff // Adafruit IO is at 52.5.238.97 // use strtoarr.py to generate these + static const char ioUser[11] = { 0x4d, 0x72, 0x41, 0x75, 0x72, 0x65, 0x6c, 0x69, 0x75, 0x73, 0x52 }; // MrAureliusR static const uint8_t ioUser_len = 11; - static const char ioUser[ioUser_len] = { 0x4d, 0x72, 0x41, 0x75, 0x72, 0x65, 0x6c, 0x69, 0x75, 0x73, 0x52 }; // MrAureliusR + static const char ioKey[32] = { }; // use strtoarr.py to generate these static const uint8_t ioKey_len = 32; - static const char ioKey[ioKey_len] = { }; + static const char ioTopic[27] = { 0x4d, 0x72, 0x41, 0x75, 0x72, 0x65, 0x6c, 0x69, 0x75, 0x73, 0x52, 0x2f, 0x66, 0x65, 0x65, 0x64, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x74, 0x6f, 0x70, 0x69, 0x63 }; // MrAureliusR/feeds/testtopic static const uint8_t ioTopic_len = 27; - static const char ioTopic[ioTopic_len] = { 0x4d, 0x72, 0x41, 0x75, 0x72, 0x65, 0x6c, 0x69, 0x75, 0x73, 0x52, 0x2f, 0x66, 0x65, 0x65, 0x64, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x74, 0x6f, 0x70, 0x69, 0x63 }; // MrAureliusR/feeds/testtopic + static const char clientID[5] = { 0x46, 0x52, 0x5a, 0x4e, 0x30 }; // FRZN0 static const uint8_t clientID_len = 5; - static const char clientID[clientID_len] = { 0x46, 0x52, 0x5a, 0x4e, 0x30 }; // FRZN0 - pGlobalSession->port = 1883; // mqtt port static const char adafruitIO_ip[4] = {52, 5, 238, 97}; diff --git a/strtoarr.py b/strtoarr.py index 3a5cf45..5f3198d 100755 --- a/strtoarr.py +++ b/strtoarr.py @@ -21,8 +21,7 @@ import os inString = str(sys.argv[1]); -print("static const uint8_t {0}_len = {1};".format(sys.argv[2], len(inString))) -print("static const char {0}[{0}_len] = {{ ".format(sys.argv[2], len(inString)), end='') +print("static const char {0}[{1}] = {{ ".format(sys.argv[2], len(inString)), end='') for letter in inString[:-1]: p = ord(letter) print("{0:#x}, ".format(p), end='') @@ -30,4 +29,4 @@ for letter in inString[:-1]: p = ord(inString[-1]) print("{0:#x} ".format(int(p)), end='') print("}; // " + inString) - +print("static const uint8_t {0}_len = {1};".format(sys.argv[2], len(inString)))