@@ -116,8 +116,10 @@ void Wippersnapper::provision() {
116116#else
117117 set_user_key (); // non-fs-backed, sets global credentials within network iface
118118#endif
119+
119120 // Set the status pixel's brightness
120121 setStatusLEDBrightness (WS._config .status_pixel_brightness );
122+
121123 // Set device's wireless credentials
122124 set_ssid_pass ();
123125}
@@ -405,7 +407,7 @@ bool cbSignalMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
405407
406408 pb_size_t arr_sz = field->array_size ;
407409 WS_DEBUG_PRINT (" Sub-messages found: " );
408- WS_DEBUG_PRINTLN (arr_sz);
410+ WS_DEBUG_PRINTLNVAR (arr_sz);
409411
410412 if (field->tag ==
411413 wippersnapper_signal_v1_CreateSignalRequest_pin_configs_tag) {
@@ -492,7 +494,7 @@ bool Wippersnapper::decodeSignalMsg(
492494/* *************************************************************************/
493495void cbSignalTopic (char *data, uint16_t len) {
494496 WS_DEBUG_PRINTLN (" cbSignalTopic: New Msg on Signal Topic" );
495- WS_DEBUG_PRINT (len);
497+ WS_DEBUG_PRINTVAR (len);
496498 WS_DEBUG_PRINTLN (" bytes." );
497499 // zero-out current buffer
498500 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -877,7 +879,7 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field,
877879/* *************************************************************************/
878880void cbSignalI2CReq (char *data, uint16_t len) {
879881 WS_DEBUG_PRINTLN (" * NEW MESSAGE [Topic: Signal-I2C]: " );
880- WS_DEBUG_PRINT (len);
882+ WS_DEBUG_PRINTVAR (len);
881883 WS_DEBUG_PRINTLN (" bytes." );
882884 // zero-out current buffer
883885 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -936,11 +938,11 @@ bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field,
936938 attached = false ;
937939 } else {
938940 WS_DEBUG_PRINT (" ATTACHED servo w/minPulseWidth: " );
939- WS_DEBUG_PRINT (msgServoAttachReq.min_pulse_width );
941+ WS_DEBUG_PRINTVAR (msgServoAttachReq.min_pulse_width );
940942 WS_DEBUG_PRINT (" uS and maxPulseWidth: " );
941- WS_DEBUG_PRINT (msgServoAttachReq.min_pulse_width );
943+ WS_DEBUG_PRINTVAR (msgServoAttachReq.min_pulse_width );
942944 WS_DEBUG_PRINT (" uS on pin: " );
943- WS_DEBUG_PRINTLN (servoPin);
945+ WS_DEBUG_PRINTLNVAR (servoPin);
944946 }
945947
946948 // Create and fill a servo response message
@@ -986,9 +988,9 @@ bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field,
986988 char *servoPin = msgServoWriteReq.servo_pin + 1 ;
987989
988990 WS_DEBUG_PRINT (" Writing pulse width of " );
989- WS_DEBUG_PRINT ((int )msgServoWriteReq.pulse_width );
991+ WS_DEBUG_PRINTVAR ((int )msgServoWriteReq.pulse_width );
990992 WS_DEBUG_PRINT (" uS to servo on pin#: " );
991- WS_DEBUG_PRINTLN (servoPin);
993+ WS_DEBUG_PRINTLNVAR (servoPin);
992994 WS._servoComponent ->servo_write (atoi (servoPin),
993995 (int )msgServoWriteReq.pulse_width );
994996 } else if (field->tag ==
@@ -1008,7 +1010,7 @@ bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field,
10081010 // execute servo detach request
10091011 char *servoPin = msgServoDetachReq.servo_pin + 1 ;
10101012 WS_DEBUG_PRINT (" Detaching servo from pin " );
1011- WS_DEBUG_PRINTLN (servoPin);
1013+ WS_DEBUG_PRINTLNVAR (servoPin);
10121014 WS._servoComponent ->servo_detach (atoi (servoPin));
10131015 } else {
10141016 WS_DEBUG_PRINTLN (" Unable to decode servo message type!" );
@@ -1029,7 +1031,7 @@ bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field,
10291031/* *************************************************************************/
10301032void cbServoMsg (char *data, uint16_t len) {
10311033 WS_DEBUG_PRINTLN (" * NEW MESSAGE [Topic: Servo]: " );
1032- WS_DEBUG_PRINT (len);
1034+ WS_DEBUG_PRINTVAR (len);
10331035 WS_DEBUG_PRINTLN (" bytes." );
10341036 // zero-out current buffer
10351037 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -1143,9 +1145,9 @@ bool cbPWMDecodeMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
11431145 // execute PWM pin duty cycle write request
11441146 char *pwmPin = msgPWMWriteFreqRequest.pin + 1 ;
11451147 WS_DEBUG_PRINT (" Writing frequency: " );
1146- WS_DEBUG_PRINT (msgPWMWriteFreqRequest.frequency );
1148+ WS_DEBUG_PRINTVAR (msgPWMWriteFreqRequest.frequency );
11471149 WS_DEBUG_PRINT (" Hz to pin " );
1148- WS_DEBUG_PRINTLN (atoi (pwmPin));
1150+ WS_DEBUG_PRINTLNVAR (atoi (pwmPin));
11491151 WS._pwmComponent ->writeTone (atoi (pwmPin), msgPWMWriteFreqRequest.frequency );
11501152 } else if (field->tag ==
11511153 wippersnapper_signal_v1_PWMRequest_write_duty_request_tag) {
@@ -1184,7 +1186,7 @@ bool cbPWMDecodeMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
11841186/* *************************************************************************/
11851187void cbPWMMsg (char *data, uint16_t len) {
11861188 WS_DEBUG_PRINTLN (" * NEW MESSAGE [Topic: PWM]: " );
1187- WS_DEBUG_PRINT (len);
1189+ WS_DEBUG_PRINTVAR (len);
11881190 WS_DEBUG_PRINTLN (" bytes." );
11891191 // zero-out current buffer
11901192 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -1271,7 +1273,7 @@ bool cbDecodeDs18x20Msg(pb_istream_t *stream, const pb_field_t *field,
12711273/* *************************************************************************/
12721274void cbSignalDSReq (char *data, uint16_t len) {
12731275 WS_DEBUG_PRINTLN (" * NEW MESSAGE [Topic: Signal-DS]: " );
1274- WS_DEBUG_PRINT (len);
1276+ WS_DEBUG_PRINTVAR (len);
12751277 WS_DEBUG_PRINTLN (" bytes." );
12761278 // zero-out current buffer
12771279 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -1384,7 +1386,7 @@ bool cbDecodePixelsMsg(pb_istream_t *stream, const pb_field_t *field,
13841386/* *************************************************************************/
13851387void cbPixelsMsg (char *data, uint16_t len) {
13861388 WS_DEBUG_PRINTLN (" * NEW MESSAGE [Topic: Pixels]: " );
1387- WS_DEBUG_PRINT (len);
1389+ WS_DEBUG_PRINTVAR (len);
13881390 WS_DEBUG_PRINTLN (" bytes." );
13891391 // zero-out current buffer
13901392 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -1509,7 +1511,7 @@ bool cbDecodeUARTMessage(pb_istream_t *stream, const pb_field_t *field,
15091511/* *************************************************************************/
15101512void cbSignalUARTReq (char *data, uint16_t len) {
15111513 WS_DEBUG_PRINTLN (" * NEW MESSAGE on Signal of type UART: " );
1512- WS_DEBUG_PRINT (len);
1514+ WS_DEBUG_PRINTVAR (len);
15131515 WS_DEBUG_PRINTLN (" bytes." );
15141516 // zero-out current buffer
15151517 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -1627,7 +1629,7 @@ bool cbDecodeDisplayMsg(pb_istream_t *stream, const pb_field_t *field,
16271629*/
16281630void cbDisplayMessage (char *data, uint16_t len) {
16291631 WS_DEBUG_PRINTLN (" * NEW MESSAGE [Topic: Display]: " );
1630- WS_DEBUG_PRINT (len);
1632+ WS_DEBUG_PRINTVAR (len);
16311633 WS_DEBUG_PRINTLN (" bytes." );
16321634 // zero-out current buffer
16331635 memset (WS._buffer , 0 , sizeof (WS._buffer ));
@@ -1708,7 +1710,7 @@ void cbRegistrationStatus(char *data, uint16_t len) {
17081710void cbErrorTopic (char *errorData, uint16_t len) {
17091711 (void )len; // marking unused parameter to avoid compiler warning
17101712 WS_DEBUG_PRINT (" IO Ban Error: " );
1711- WS_DEBUG_PRINTLN (errorData);
1713+ WS_DEBUG_PRINTLNVAR (errorData);
17121714 // Disconnect client from broker
17131715 WS_DEBUG_PRINT (" Disconnecting from MQTT.." );
17141716 if (!WS._mqtt ->disconnect ()) {
@@ -1732,7 +1734,7 @@ void cbErrorTopic(char *errorData, uint16_t len) {
17321734void cbThrottleTopic (char *throttleData, uint16_t len) {
17331735 (void )len; // marking unused parameter to avoid compiler warning
17341736 WS_DEBUG_PRINT (" IO Throttle Error: " );
1735- WS_DEBUG_PRINTLN (throttleData);
1737+ WS_DEBUG_PRINTLNVAR (throttleData);
17361738 char *throttleMessage;
17371739 // Parse out # of seconds from message buffer
17381740 throttleMessage = strtok (throttleData, " ," );
@@ -1741,7 +1743,7 @@ void cbThrottleTopic(char *throttleData, uint16_t len) {
17411743 int throttleDuration = atoi (throttleMessage) * 1000 ;
17421744
17431745 WS_DEBUG_PRINT (" Device is throttled for " );
1744- WS_DEBUG_PRINT (throttleDuration);
1746+ WS_DEBUG_PRINTVAR (throttleDuration);
17451747 WS_DEBUG_PRINTLN (" ms and blocking command execution." );
17461748
17471749 // If throttle duration is less than the keepalive interval, delay for the
@@ -2346,7 +2348,7 @@ bool Wippersnapper::generateWSTopics() {
23462348 _topic_signal_display_sub =
23472349 new Adafruit_MQTT_Subscribe (WS._mqtt , WS._topic_signal_display_brkr , 1 );
23482350 WS_DEBUG_PRINTLN (" Subscribing to DISPLAY topic: " );
2349- WS_DEBUG_PRINTLN (WS._topic_signal_display_brkr );
2351+ WS_DEBUG_PRINTLNVAR (WS._topic_signal_display_brkr );
23502352 WS._mqtt ->subscribe (_topic_signal_display_sub);
23512353 WS_DEBUG_PRINTLN (" Subscribed to DISPLAY topic!" );
23522354 _topic_signal_display_sub->setCallback (cbDisplayMessage);
@@ -2387,7 +2389,7 @@ bool Wippersnapper::generateWSTopics() {
23872389/* *************************************************************************/
23882390void Wippersnapper::errorWriteHang (String error) {
23892391 // Print error
2390- WS_DEBUG_PRINTLN (error);
2392+ WS_DEBUG_PRINTLNVAR (error);
23912393#ifdef USE_TINYUSB
23922394 _fileSystem->writeToBootOut (error.c_str ());
23932395 TinyUSBDevice.attach ();
@@ -2396,7 +2398,7 @@ void Wippersnapper::errorWriteHang(String error) {
23962398 // Signal and hang forever
23972399 while (1 ) {
23982400 WS_DEBUG_PRINTLN (" ERROR: Halted execution" );
2399- WS_DEBUG_PRINTLN (error.c_str ());
2401+ WS_DEBUG_PRINTLNVAR (error.c_str ());
24002402 WS.feedWDT ();
24012403 statusLEDBlink (WS_LED_STATUS_ERROR_RUNTIME);
24022404 delay (1000 );
@@ -2451,7 +2453,7 @@ void Wippersnapper::runNetFSM() {
24512453 feedWDT ();
24522454 // attempt to connect
24532455 WS_DEBUG_PRINT (" Connecting to WiFi (attempt #" );
2454- WS_DEBUG_PRINT (5 - maxAttempts);
2456+ WS_DEBUG_PRINTVAR (5 - maxAttempts);
24552457 WS_DEBUG_PRINTLN (" )" );
24562458 WS_PRINTER.flush ();
24572459 feedWDT ();
@@ -2477,11 +2479,11 @@ void Wippersnapper::runNetFSM() {
24772479 maxAttempts = 5 ;
24782480 while (maxAttempts > 0 ) {
24792481 WS_DEBUG_PRINT (" Connecting to AIO MQTT (attempt #" );
2480- WS_DEBUG_PRINT (5 - maxAttempts);
2482+ WS_DEBUG_PRINTVAR (5 - maxAttempts);
24812483 WS_DEBUG_PRINTLN (" )" );
24822484 WS_PRINTER.flush ();
24832485 WS_DEBUG_PRINT (" WiFi Status: " );
2484- WS_DEBUG_PRINTLN (networkStatus ());
2486+ WS_DEBUG_PRINTLNVAR (networkStatus ());
24852487 WS_PRINTER.flush ();
24862488 feedWDT ();
24872489 statusLEDBlink (WS_LED_STATUS_MQTT_CONNECTING);
@@ -2493,8 +2495,8 @@ void Wippersnapper::runNetFSM() {
24932495 break ;
24942496 }
24952497 WS_DEBUG_PRINT (" MQTT Connection Error: " );
2496- WS_DEBUG_PRINTLN (mqttRC);
2497- WS_DEBUG_PRINTLN (WS._mqtt ->connectErrorString (mqttRC));
2498+ WS_DEBUG_PRINTLNVAR (mqttRC);
2499+ WS_DEBUG_PRINTLNVAR (WS._mqtt ->connectErrorString (mqttRC));
24982500 WS_DEBUG_PRINTLN (
24992501 " Unable to connect to Adafruit IO MQTT, retrying in 3 seconds..." );
25002502 delay (3000 );
@@ -2536,9 +2538,9 @@ void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
25362538
25372539 for (int i = 0 ;; i++) {
25382540 WS_DEBUG_PRINT (" ERROR [WDT RESET IN " );
2539- WS_DEBUG_PRINT (seconds_until_reboot - i);
2541+ WS_DEBUG_PRINTVAR (seconds_until_reboot - i);
25402542 WS_DEBUG_PRINTLN (" ]: " );
2541- WS_DEBUG_PRINTLN (error);
2543+ WS_DEBUG_PRINTLNVAR (error);
25422544 // let the WDT fail out and reset!
25432545 statusLEDSolid (ledStatusColor);
25442546#ifndef ARDUINO_ARCH_ESP8266
@@ -2610,7 +2612,7 @@ void Wippersnapper::pingBroker() {
26102612 }
26112613 _prv_ping = millis ();
26122614 WS_DEBUG_PRINT (" WiFi RSSI: " );
2613- WS_DEBUG_PRINTLN (getRSSI ());
2615+ WS_DEBUG_PRINTLNVAR (getRSSI ());
26142616 }
26152617 // blink status LED every STATUS_LED_KAT_BLINK_TIME millis
26162618 if (millis () > (_prvKATBlink + STATUS_LED_KAT_BLINK_TIME)) {
@@ -2756,21 +2758,21 @@ void printDeviceInfo() {
27562758 WS_DEBUG_PRINT (" Board ID: " );
27572759 WS_DEBUG_PRINTLN (BOARD_ID);
27582760 WS_DEBUG_PRINT (" Adafruit.io User: " );
2759- WS_DEBUG_PRINTLN (WS._config .aio_user );
2761+ WS_DEBUG_PRINTLNVAR (WS._config .aio_user );
27602762 if (strncmp (WS._config .aio_url , " io.adafruit.com" , 16 ) != 0 ) {
27612763 WS_DEBUG_PRINT (" Adafruit.io URL: " );
2762- WS_DEBUG_PRINTLN (WS._config .aio_url );
2764+ WS_DEBUG_PRINTLNVAR (WS._config .aio_url );
27632765 WS_DEBUG_PRINT (" Adafruit.io Port: " );
2764- WS_DEBUG_PRINTLN (WS._config .io_port );
2766+ WS_DEBUG_PRINTLNVAR (WS._config .io_port );
27652767 }
27662768 WS_DEBUG_PRINT (" WiFi Network: " );
2767- WS_DEBUG_PRINTLN (WS._config .network .ssid );
2769+ WS_DEBUG_PRINTLNVAR (WS._config .network .ssid );
27682770
27692771 char sMAC [18 ] = {0 };
27702772 sprintf (sMAC , " %02X:%02X:%02X:%02X:%02X:%02X" , WS._macAddr [0 ], WS._macAddr [1 ],
27712773 WS._macAddr [2 ], WS._macAddr [3 ], WS._macAddr [4 ], WS._macAddr [5 ]);
27722774 WS_DEBUG_PRINT (" MAC Address: " );
2773- WS_DEBUG_PRINTLN (sMAC );
2775+ WS_DEBUG_PRINTLNVAR (sMAC );
27742776 WS_DEBUG_PRINTLN (" -------------------------------" );
27752777
27762778// (ESP32-Only) Print reason why device was reset
0 commit comments