Skip to content

Commit 51972f9

Browse files
committed
Test Dotstar with FunHouse
1 parent 81ba6c3 commit 51972f9

File tree

7 files changed

+47
-37
lines changed

7 files changed

+47
-37
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ examples/Wippersnapper_demo_offline/build/
6363
report.xml
6464

6565
# VSCode settings
66-
.vscode/settings.json
66+
.vscode/settings.json
67+
68+
CLAUDE.md

platformio.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ monitor_speed = 115200
1717
extra_scripts = upload_no_build.py
1818
lib_compat_mode = strict
1919
lib_deps =
20+
;;;;;;;;;;; FunHouse / LVGL Boards uncomment these ;;;;;;;;;;;;;;
21+
https://github.com/adafruit/Adafruit_HX8357_Library.git
22+
https://github.com/adafruit/Adafruit_ILI9341.git
23+
https://github.com/adafruit/Adafruit_STMPE610.git
24+
https://github.com/adafruit/Adafruit-ST7735-Library.git
25+
https://github.com/adafruit/Adafruit_TouchScreen.git
26+
https://github.com/brentru/lvgl.git#wippersnapper
27+
https://github.com/brentru/Adafruit_LvGL_Glue.git#development
2028
adafruit/Adafruit TinyUSB Library
2129
adafruit/Adafruit Zero DMA Library
2230
adafruit/Adafruit SPIFlash

src/Wippersnapper_V2.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,21 @@ void Wippersnapper_V2::provision() {
108108
// Initialize the display
109109
displayConfig config;
110110
WsV2._fileSystemV2->parseDisplayConfig(config);
111-
WsV2._display = new ws_display_driver(config);
111+
WsV2._displayV2 = new ws_display_driver(config);
112112
// Begin display
113-
if (!WsV2._display->begin()) {
113+
if (!WsV2._displayV2->begin()) {
114114
WS_DEBUG_PRINTLN("Unable to enable display driver and LVGL");
115115
haltErrorV2("Unable to enable display driver, please check the json "
116116
"configuration!");
117117
}
118118

119-
WsV2._display->enableLogging();
119+
WsV2._displayV2->enableLogging();
120120
ReleaseStatusPixel(); // don't use status LED if we are using the display
121121
// UI Setup
122-
WsV2._ui_helper = new ws_display_ui_helper(WsV2._display);
123-
WsV2._ui_helper->set_bg_black();
124-
WsV2._ui_helper->show_scr_load();
125-
WsV2._ui_helper->set_label_status("Validating Credentials...");
122+
WsV2._ui_helperV2 = new ws_display_ui_helper(WsV2._displayV2);
123+
WsV2._ui_helperV2->set_bg_black();
124+
WsV2._ui_helperV2->show_scr_load();
125+
WsV2._ui_helperV2->set_label_status("Validating Credentials...");
126126
#endif
127127

128128
#ifdef USE_TINYUSB
@@ -139,8 +139,8 @@ void Wippersnapper_V2::provision() {
139139
set_ssid_pass();
140140

141141
#ifdef USE_DISPLAY
142-
WsV2._ui_helper->set_label_status("");
143-
WsV2._ui_helper->set_load_bar_icon_complete(loadBarIconFile);
142+
WsV2._ui_helperV2->set_label_status("");
143+
WsV2._ui_helperV2->set_load_bar_icon_complete(loadBarIconFile);
144144
#endif
145145
}
146146

@@ -515,7 +515,7 @@ void cbErrorTopicV2(char *errorData, uint16_t len) {
515515
}
516516

517517
#ifdef USE_DISPLAY
518-
WsV2._ui_helper->show_scr_error("IO Ban Error", errorData);
518+
WsV2._ui_helperV2->show_scr_error("IO Ban Error", errorData);
519519
#endif
520520

521521
// WDT reset
@@ -554,7 +554,7 @@ void cbThrottleTopicV2(char *throttleData, uint16_t len) {
554554
buffer, 100,
555555
"[IO ERROR] Device is throttled for %d mS and blocking execution..\n.",
556556
throttleDuration);
557-
WsV2._ui_helper->add_text_to_terminal(buffer);
557+
WsV2._ui_helperV2->add_text_to_terminal(buffer);
558558
#endif
559559

560560
// If throttle duration is less than the keepalive interval, delay for the
@@ -574,7 +574,7 @@ void cbThrottleTopicV2(char *throttleData, uint16_t len) {
574574
}
575575
WS_DEBUG_PRINTLN("Device is un-throttled, resumed command execution");
576576
#ifdef USE_DISPLAY
577-
WsV2._ui_helper->add_text_to_terminal(
577+
WsV2._ui_helperV2->add_text_to_terminal(
578578
"[IO] Device is un-throttled, resuming...\n");
579579
#endif
580580
}
@@ -784,8 +784,8 @@ void Wippersnapper_V2::runNetFSMV2() {
784784
if (networkStatus() == WS_NET_CONNECTED) {
785785
WS_DEBUG_PRINTLN("Connected to WiFi!");
786786
#ifdef USE_DISPLAY
787-
if (WsV2._ui_helper->getLoadingState())
788-
WsV2._ui_helper->set_load_bar_icon_complete(loadBarIconWifi);
787+
if (WsV2._ui_helperV2->getLoadingState())
788+
WsV2._ui_helperV2->set_load_bar_icon_complete(loadBarIconWifi);
789789
#endif
790790
fsmNetwork = FSM_NET_ESTABLISH_MQTT;
791791
break;
@@ -796,15 +796,15 @@ void Wippersnapper_V2::runNetFSMV2() {
796796
WS_DEBUG_PRINTLN("Establishing network connection...");
797797
WS_PRINTER.flush();
798798
#ifdef USE_DISPLAY
799-
if (WsV2._ui_helper->getLoadingState())
800-
WsV2._ui_helper->set_label_status("Connecting to WiFi...");
799+
if (WsV2._ui_helperV2->getLoadingState())
800+
WsV2._ui_helperV2->set_label_status("Connecting to WiFi...");
801801
#endif
802802
// Perform a WiFi scan and check if SSID within
803803
// secrets.json is within the scanned SSIDs
804804
WS_DEBUG_PRINT("Performing a WiFi scan for SSID...");
805805
if (!check_valid_ssid()) {
806806
#ifdef USE_DISPLAY
807-
WsV2._ui_helper->show_scr_error("ERROR",
807+
WsV2._ui_helperV2->show_scr_error("ERROR",
808808
"Unable to find WiFi network listed in "
809809
"the secrets file. Rebooting soon...");
810810
#endif
@@ -834,7 +834,7 @@ void Wippersnapper_V2::runNetFSMV2() {
834834
if (networkStatus() != WS_NET_CONNECTED) {
835835
WS_DEBUG_PRINTLN("ERROR: Unable to connect to WiFi!");
836836
#ifdef USE_DISPLAY
837-
WsV2._ui_helper->show_scr_error(
837+
WsV2._ui_helperV2->show_scr_error(
838838
"CONNECTION ERROR",
839839
"Unable to connect to WiFi Network. Please check that you entered "
840840
"the WiFi credentials correctly. Rebooting in 5 seconds...");
@@ -847,8 +847,8 @@ void Wippersnapper_V2::runNetFSMV2() {
847847
break;
848848
case FSM_NET_ESTABLISH_MQTT:
849849
#ifdef USE_DISPLAY
850-
if (WsV2._ui_helper->getLoadingState())
851-
WsV2._ui_helper->set_label_status("Connecting to IO...");
850+
if (WsV2._ui_helperV2->getLoadingState())
851+
WsV2._ui_helperV2->set_label_status("Connecting to IO...");
852852
#endif
853853
WsV2._mqttV2->setKeepAliveInterval(WS_KEEPALIVE_INTERVAL_MS / 1000);
854854
// Attempt to connect
@@ -880,7 +880,7 @@ void Wippersnapper_V2::runNetFSMV2() {
880880
}
881881
if (fsmNetwork != FSM_NET_CHECK_MQTT) {
882882
#ifdef USE_DISPLAY
883-
WsV2._ui_helper->show_scr_error(
883+
WsV2._ui_helperV2->show_scr_error(
884884
"CONNECTION ERROR",
885885
"Unable to connect to Adafruit.io. If you are repeatedly having "
886886
"this issue, please check that your IO Username and IO Key are set "
@@ -1126,12 +1126,12 @@ void Wippersnapper_V2::pingBrokerV2() {
11261126
if (WsV2._mqttV2->ping()) {
11271127
WS_DEBUG_PRINTLN("SUCCESS!");
11281128
#ifdef USE_DISPLAY
1129-
WsV2._ui_helper->add_text_to_terminal("[NET] Sent KeepAlive ping!\n");
1129+
WsV2._ui_helperV2->add_text_to_terminal("[NET] Sent KeepAlive ping!\n");
11301130
#endif
11311131
} else {
11321132
WS_DEBUG_PRINTLN("FAILURE! Running network FSM...");
11331133
#ifdef USE_DISPLAY
1134-
WsV2._ui_helper->add_text_to_terminal(
1134+
WsV2._ui_helperV2->add_text_to_terminal(
11351135
"[NET] EROR: Failed to send KeepAlive ping!\n");
11361136
#endif
11371137
WsV2._mqttV2->disconnect();
@@ -1304,8 +1304,8 @@ void Wippersnapper_V2::connect() {
13041304
WsV2.feedWDTV2();
13051305

13061306
#ifdef USE_DISPLAY
1307-
WsV2._ui_helper->set_load_bar_icon_complete(loadBarIconCloud);
1308-
WsV2._ui_helper->set_label_status("Sending device info...");
1307+
WsV2._ui_helperV2->set_load_bar_icon_complete(loadBarIconCloud);
1308+
WsV2._ui_helperV2->set_label_status("Sending device info...");
13091309
#endif
13101310

13111311
WS_DEBUG_PRINTLN("Performing checkin handshake...");
@@ -1325,9 +1325,9 @@ void Wippersnapper_V2::connect() {
13251325
// switch to monitor screen
13261326
#ifdef USE_DISPLAY
13271327
WS_DEBUG_PRINTLN("Clearing loading screen...");
1328-
WsV2._ui_helper->clear_scr_load();
1328+
WsV2._ui_helperV2->clear_scr_load();
13291329
WS_DEBUG_PRINTLN("building monitor screen...");
1330-
WsV2._ui_helper->build_scr_monitor();
1330+
WsV2._ui_helperV2->build_scr_monitor();
13311331
#endif
13321332
WS_DEBUG_PRINTLN("Running app loop...");
13331333
}

src/display/ws_display_driver.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
#ifndef WIPPERSNAPPER_DISPLAY_H
1616
#define WIPPERSNAPPER_DISPLAY_H
1717

18-
#include "Wippersnapper.h"
18+
#include "Wippersnapper_V2.h"
1919
#include "provisioning/Config.h"
2020
#include <Adafruit_LvGL_Glue.h> // Always include this BEFORE lvgl.h!
2121
#include <Adafruit_ST7789.h>
2222
#include <lvgl.h>
2323

2424
LV_FONT_DECLARE(errorTriangle); ///< Error triangle symbol/font
2525

26-
class Wippersnapper; // fwd decl
26+
class Wippersnapper_V2; // fwd decl
2727

2828
/***************************************************************************/
2929
/*!
@@ -51,6 +51,6 @@ class ws_display_driver {
5151
uint8_t
5252
_displayRotationMode; ///< Display rotation (mode, not number in degrees)
5353
};
54-
extern Wippersnapper WS; ///< Global Wippersnapper instance
54+
extern Wippersnapper_V2 WsV2; ///< Global Wippersnapper instance
5555

5656
#endif // WIPPERSNAPPER_DISPLAY_H

src/display/ws_display_ui_helper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ void ws_display_ui_helper::build_scr_monitor() {
404404
/**************************************************************************/
405405
void ws_display_ui_helper::add_text_to_terminal(const char *text) {
406406
Serial.println("add_text_to_terminal");
407-
char txtBuffer[256]; // temporary text buffer for snprintf
407+
/* char txtBuffer[256]; // temporary text buffer for snprintf
408408
snprintf(txtBuffer, 256, text);
409-
addToTerminal(txtBuffer);
409+
addToTerminal(txtBuffer); */
410410
}
411411

412412
/**************************************************************************/

src/display/ws_display_ui_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifndef WS_DISPLAY_UI_HELPER_H
1717
#define WS_DISPLAY_UI_HELPER_H
1818

19-
#include "Wippersnapper.h"
19+
#include "Wippersnapper_V2.h"
2020
#include "ws_display_driver.h"
2121
#include "ws_display_tooltips.h"
2222
#include <lvgl.h>

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Wippersnapper_FS::Wippersnapper_FS() {
148148
writeToBootOut(
149149
"Please edit the secrets.json file. Then, reset your board.\n");
150150
#ifdef USE_DISPLAY
151-
WsV2._ui_helper->show_scr_error(
151+
WsV2._ui_helperV2->show_scr_error(
152152
"INVALID SETTINGS FILE",
153153
"The settings.json file on the WIPPER drive contains default values. "
154154
"Please edit it to reflect your Adafruit IO and network credentials. "
@@ -472,7 +472,7 @@ void Wippersnapper_FS::parseSecrets() {
472472
"ERROR: Invalid IO credentials in secrets.json! TO FIX: Please change "
473473
"io_username and io_key to match your Adafruit IO credentials!\n");
474474
#ifdef USE_DISPLAY
475-
WsV2._ui_helper->show_scr_error(
475+
WsV2._ui_helperV2->show_scr_error(
476476
"INVALID IO CREDS",
477477
"The \"io_username/io_key\" fields within secrets.json are invalid, "
478478
"please "
@@ -489,7 +489,7 @@ void Wippersnapper_FS::parseSecrets() {
489489
"FIX: Please change network_ssid and network_password to "
490490
"match your Adafruit IO credentials!\n");
491491
#ifdef USE_DISPLAY
492-
WsV2._ui_helper->show_scr_error(
492+
WsV2._ui_helperV2->show_scr_error(
493493
"INVALID NETWORK",
494494
"The \"network_ssid and network_password\" fields within secrets.json "
495495
"are invalid, please change it to match your WiFi credentials. Then, "

0 commit comments

Comments
 (0)