From c6f08ef07ba1fe707e6cb7329aef610169c756c9 Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Wed, 3 Apr 2019 21:02:38 -0400 Subject: [PATCH 01/10] update Firmware --- WeatherBuddy/src/WeatherBuddy.ino | 36 ++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/WeatherBuddy/src/WeatherBuddy.ino b/WeatherBuddy/src/WeatherBuddy.ino index 0e4ea77..0772989 100644 --- a/WeatherBuddy/src/WeatherBuddy.ino +++ b/WeatherBuddy/src/WeatherBuddy.ino @@ -5,14 +5,44 @@ * Date: March 31, 2019 */ +// This #include statement was automatically added by the Particle IDE. +#include + +USARTSerial &nexSerial = Serial1; + +// Index Page Nexobject [page id:0,component id:1, component name: "b0"] +NexText textLow(0, 3, "textLow"); +NexText textHigh(0, 4, "textHigh"); +NexText textTemp(0, 2, "textTemp"); +NexText textLocation(0, 3, "textLocation"); + +int temperatureLow = 0; +int temperatureHigh = 0; +int temperature = 0; +float humidity = 0; +char buffer[100] = {0}; + +/* + * Register a button object to the touch event list. + */ + // setup() runs once, when the device is first turned on. -void setup() { +void setup(void) +{ // Put initialization like pinMode and begin functions here. - + nexInit(); // Set the baudrate which is for debug and communicate with Nextion screen. + Time.zone(-5); // Set Time Zone to EST } // loop() runs over and over again, as quickly as it can execute. -void loop() { +void loop(void) +{ // The core of your code will likely live here. +} +String getTime() +{ + String timeNow = Time.format(Time.now(), TIME_FORMAT_DEFAULT); + timeNow = timeNow.substring(11, timeNow.length() - 6); + return " " + timeNow; } \ No newline at end of file From cbdb68cf210166c0903b6dcffb9eefbc67baf355 Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Wed, 3 Apr 2019 21:05:11 -0400 Subject: [PATCH 02/10] update hmi --- UserInterface/NextionEditor/WeatherBuddy.HMI | Bin 231327 -> 231327 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/UserInterface/NextionEditor/WeatherBuddy.HMI b/UserInterface/NextionEditor/WeatherBuddy.HMI index d666c1ae370ac3f2cc600d6969c4ccf94140a3d3..4fe5cca18813cc3b3feecf05629bd6994335b45b 100644 GIT binary patch delta 40 wcmbQ=&o{rHuc3vpg=q_OXaytZ^sowMOGb|Afwjy!+xJv3-{)f~kw|m{025gZ;s5{u delta 38 ucmbQ=&o{rHuc3vpg=q_OXaytp^sowM%jp5N%(~n6R50J?WAR%P)C~Xy%?*D5 From 0c1cadf6795aa79a80842861d144522cefc72a2c Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Thu, 4 Apr 2019 15:10:02 -0400 Subject: [PATCH 03/10] add build script --- bin/build | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 bin/build diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..16b855f --- /dev/null +++ b/bin/build @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +particle compile photon --target 1.0.1 WeatherBuddy --saveTo builds/WeatherBuddy.photon.bin \ No newline at end of file From b3bd2d10f00816609fea2f59f843f671e9b0426a Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Thu, 4 Apr 2019 15:23:38 -0400 Subject: [PATCH 04/10] add dfu mode script --- bin/dfu-mac | 3 +++ bin/flash | 3 +++ 2 files changed, 6 insertions(+) create mode 100755 bin/dfu-mac create mode 100755 bin/flash diff --git a/bin/dfu-mac b/bin/dfu-mac new file mode 100755 index 0000000..7e8a571 --- /dev/null +++ b/bin/dfu-mac @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +stty -f /dev/cu.usbmodem144101 14400 \ No newline at end of file diff --git a/bin/flash b/bin/flash new file mode 100755 index 0000000..d074e94 --- /dev/null +++ b/bin/flash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +particle flash --usb firmware.bin \ No newline at end of file From 8397d334c30904824fd890fe0bb6d00931778ce8 Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Thu, 4 Apr 2019 19:03:36 -0400 Subject: [PATCH 05/10] working text events --- UserInterface/NextionEditor/WeatherBuddy.HMI | Bin 231327 -> 231327 bytes UserInterface/NextionExports/WeatherBuddy.tft | Bin 398377 -> 398377 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/UserInterface/NextionEditor/WeatherBuddy.HMI b/UserInterface/NextionEditor/WeatherBuddy.HMI index 4fe5cca18813cc3b3feecf05629bd6994335b45b..81d85084ed9cbe595a471c95e3edd82f167d6546 100644 GIT binary patch delta 49 xcmbQ=&o{rHuc3vpg=q`(jAlmW=`)*|je*oz2*ua};%zr=VNPRa>3wOZ3;>cb4)p*4 delta 49 xcmbQ=&o{rHuc3vpg=q`(jAllL=`)*|je*oz2*ua};%zr=VNPRaDUnEY0|1V-4n+U} diff --git a/UserInterface/NextionExports/WeatherBuddy.tft b/UserInterface/NextionExports/WeatherBuddy.tft index 72bef4ffd977727384640b43a7a4dcce9f496d70..d53e25b2ec0edef3ec31205e3c926ff9db71e769 100644 GIT binary patch delta 116 zcmZ3vLSp3#iG~)&7N#xClEuu73=G?4ikW5E21oHnu1x(u`Dw%

j}{-@HAdk{O6u zwntR5=1gH^n0}O(?GBF!LnuQ4LlHwRP}%ggd~DBw5>xp>)b?5dwiV1Q5ocex0sw|0 B8mIsO From cac6d77e11b5580a016bda2137667a070876c787 Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Thu, 4 Apr 2019 19:08:32 -0400 Subject: [PATCH 06/10] working test code --- WeatherBuddy/src/WeatherBuddy.ino | 43 +++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/WeatherBuddy/src/WeatherBuddy.ino b/WeatherBuddy/src/WeatherBuddy.ino index 0772989..ecd8708 100644 --- a/WeatherBuddy/src/WeatherBuddy.ino +++ b/WeatherBuddy/src/WeatherBuddy.ino @@ -14,34 +14,51 @@ USARTSerial &nexSerial = Serial1; NexText textLow(0, 3, "textLow"); NexText textHigh(0, 4, "textHigh"); NexText textTemp(0, 2, "textTemp"); -NexText textLocation(0, 3, "textLocation"); +NexText textLocation(0, 5, "textLocation"); int temperatureLow = 0; int temperatureHigh = 0; int temperature = 0; -float humidity = 0; -char buffer[100] = {0}; -/* - * Register a button object to the touch event list. - */ +char buffer[100] = {0}; -// setup() runs once, when the device is first turned on. -void setup(void) +NexTouch *nex_Listen_List[] = { - // Put initialization like pinMode and begin functions here. + &textLow, + &textHigh, + &textTemp, + NULL +}; + + +void textTempPopCallback(void *ptr) { + NexText *text = (NexText *)ptr; + memset(buffer, 0, sizeof(buffer)); + text->getText(buffer, sizeof(buffer)); + if (strcmp(buffer,"ON")) { + digitalWrite(9, HIGH); + strcpy(buffer, "ON"); + } else { + digitalWrite(9, LOW); + strcpy(buffer, "OFF"); + } + text->setText(buffer); +} + +// Put initialization like pinMode and begin functions here. +void setup(void) { nexInit(); // Set the baudrate which is for debug and communicate with Nextion screen. + textTemp.attachPop(textTempPopCallback, &textTemp); Time.zone(-5); // Set Time Zone to EST } // loop() runs over and over again, as quickly as it can execute. -void loop(void) -{ +void loop(void) { // The core of your code will likely live here. + nexLoop(nex_Listen_List); } -String getTime() -{ +String getTime() { String timeNow = Time.format(Time.now(), TIME_FORMAT_DEFAULT); timeNow = timeNow.substring(11, timeNow.length() - 6); return " " + timeNow; From acf5050e41863cf49930bb7136a3600205799fdf Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Wed, 3 Apr 2019 21:02:38 -0400 Subject: [PATCH 07/10] update Firmware --- WeatherBuddy/src/WeatherBuddy.ino | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/WeatherBuddy/src/WeatherBuddy.ino b/WeatherBuddy/src/WeatherBuddy.ino index 4e4af98..0772989 100644 --- a/WeatherBuddy/src/WeatherBuddy.ino +++ b/WeatherBuddy/src/WeatherBuddy.ino @@ -14,27 +14,34 @@ USARTSerial &nexSerial = Serial1; NexText textLow(0, 3, "textLow"); NexText textHigh(0, 4, "textHigh"); NexText textTemp(0, 2, "textTemp"); -NexText textLocation(0, 5, "textLocation"); +NexText textLocation(0, 3, "textLocation"); int temperatureLow = 0; int temperatureHigh = 0; int temperature = 0; float humidity = 0; - char buffer[100] = {0}; -// Put initialization like pinMode and begin functions here. -void setup(void) { +/* + * Register a button object to the touch event list. + */ + +// setup() runs once, when the device is first turned on. +void setup(void) +{ + // Put initialization like pinMode and begin functions here. nexInit(); // Set the baudrate which is for debug and communicate with Nextion screen. Time.zone(-5); // Set Time Zone to EST } // loop() runs over and over again, as quickly as it can execute. -void loop(void) { +void loop(void) +{ // The core of your code will likely live here. } -String getTime() { +String getTime() +{ String timeNow = Time.format(Time.now(), TIME_FORMAT_DEFAULT); timeNow = timeNow.substring(11, timeNow.length() - 6); return " " + timeNow; From c66cfb25eea270edc19111710418a731f1445a11 Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Wed, 3 Apr 2019 21:05:11 -0400 Subject: [PATCH 08/10] update hmi --- UserInterface/NextionEditor/WeatherBuddy.HMI | Bin 231327 -> 231327 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/UserInterface/NextionEditor/WeatherBuddy.HMI b/UserInterface/NextionEditor/WeatherBuddy.HMI index d666c1ae370ac3f2cc600d6969c4ccf94140a3d3..4fe5cca18813cc3b3feecf05629bd6994335b45b 100644 GIT binary patch delta 40 wcmbQ=&o{rHuc3vpg=q_OXaytZ^sowMOGb|Afwjy!+xJv3-{)f~kw|m{025gZ;s5{u delta 38 ucmbQ=&o{rHuc3vpg=q_OXaytp^sowM%jp5N%(~n6R50J?WAR%P)C~Xy%?*D5 From a0f0558f2227ae247df503d3822e0b59fea3ba8f Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Thu, 4 Apr 2019 19:03:36 -0400 Subject: [PATCH 09/10] working text events --- UserInterface/NextionEditor/WeatherBuddy.HMI | Bin 231327 -> 231327 bytes UserInterface/NextionExports/WeatherBuddy.tft | Bin 398377 -> 398377 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/UserInterface/NextionEditor/WeatherBuddy.HMI b/UserInterface/NextionEditor/WeatherBuddy.HMI index 4fe5cca18813cc3b3feecf05629bd6994335b45b..81d85084ed9cbe595a471c95e3edd82f167d6546 100644 GIT binary patch delta 49 xcmbQ=&o{rHuc3vpg=q`(jAlmW=`)*|je*oz2*ua};%zr=VNPRa>3wOZ3;>cb4)p*4 delta 49 xcmbQ=&o{rHuc3vpg=q`(jAllL=`)*|je*oz2*ua};%zr=VNPRaDUnEY0|1V-4n+U} diff --git a/UserInterface/NextionExports/WeatherBuddy.tft b/UserInterface/NextionExports/WeatherBuddy.tft index 72bef4ffd977727384640b43a7a4dcce9f496d70..d53e25b2ec0edef3ec31205e3c926ff9db71e769 100644 GIT binary patch delta 116 zcmZ3vLSp3#iG~)&7N#xClEuu73=G?4ikW5E21oHnu1x(u`Dw%

j}{-@HAdk{O6u zwntR5=1gH^n0}O(?GBF!LnuQ4LlHwRP}%ggd~DBw5>xp>)b?5dwiV1Q5ocex0sw|0 B8mIsO From 3d769ded653cf119813f09b91ae57f77b1a4edc1 Mon Sep 17 00:00:00 2001 From: Graham Plata Date: Thu, 4 Apr 2019 19:08:32 -0400 Subject: [PATCH 10/10] working test code --- WeatherBuddy/src/WeatherBuddy.ino | 43 +++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/WeatherBuddy/src/WeatherBuddy.ino b/WeatherBuddy/src/WeatherBuddy.ino index 0772989..ecd8708 100644 --- a/WeatherBuddy/src/WeatherBuddy.ino +++ b/WeatherBuddy/src/WeatherBuddy.ino @@ -14,34 +14,51 @@ USARTSerial &nexSerial = Serial1; NexText textLow(0, 3, "textLow"); NexText textHigh(0, 4, "textHigh"); NexText textTemp(0, 2, "textTemp"); -NexText textLocation(0, 3, "textLocation"); +NexText textLocation(0, 5, "textLocation"); int temperatureLow = 0; int temperatureHigh = 0; int temperature = 0; -float humidity = 0; -char buffer[100] = {0}; -/* - * Register a button object to the touch event list. - */ +char buffer[100] = {0}; -// setup() runs once, when the device is first turned on. -void setup(void) +NexTouch *nex_Listen_List[] = { - // Put initialization like pinMode and begin functions here. + &textLow, + &textHigh, + &textTemp, + NULL +}; + + +void textTempPopCallback(void *ptr) { + NexText *text = (NexText *)ptr; + memset(buffer, 0, sizeof(buffer)); + text->getText(buffer, sizeof(buffer)); + if (strcmp(buffer,"ON")) { + digitalWrite(9, HIGH); + strcpy(buffer, "ON"); + } else { + digitalWrite(9, LOW); + strcpy(buffer, "OFF"); + } + text->setText(buffer); +} + +// Put initialization like pinMode and begin functions here. +void setup(void) { nexInit(); // Set the baudrate which is for debug and communicate with Nextion screen. + textTemp.attachPop(textTempPopCallback, &textTemp); Time.zone(-5); // Set Time Zone to EST } // loop() runs over and over again, as quickly as it can execute. -void loop(void) -{ +void loop(void) { // The core of your code will likely live here. + nexLoop(nex_Listen_List); } -String getTime() -{ +String getTime() { String timeNow = Time.format(Time.now(), TIME_FORMAT_DEFAULT); timeNow = timeNow.substring(11, timeNow.length() - 6); return " " + timeNow;