|
50 | 50 | * -- rlr, Oct. 24, 2022 |
51 | 51 | */ |
52 | 52 |
|
| 53 | +#include <array> |
| 54 | + |
53 | 55 | #include "alarm_api.h" |
54 | 56 | #include "GPAD_HAL.h" |
55 | 57 | #include "gpad_utility.h" |
@@ -150,13 +152,14 @@ const char *mqtt_broker_name = "public.cloud.shiftr.io"; |
150 | 152 | const char *mqtt_user = "public"; |
151 | 153 | const char *mqtt_password = "public"; |
152 | 154 |
|
| 155 | +const size_t MAC_ADDRESS_STRING_LENGTH = 13; |
153 | 156 | // MQTT Topics, MAC plus an extention |
154 | 157 | // A MAC addresss treated as a string has 12 chars. |
155 | 158 | // The strings "_ALM" and "_ACK" have 4 chars. |
156 | 159 | // A null character is one other. 12 + 4 + 1 = 17 |
157 | 160 | char subscribe_Alarm_Topic[17]; |
158 | 161 | char publish_Ack_Topic[17]; |
159 | | -char macAddressString[13]; |
| 162 | +char macAddressString[MAC_ADDRESS_STRING_LENGTH]; |
160 | 163 |
|
161 | 164 | #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] |
162 | 165 | #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" |
@@ -484,12 +487,15 @@ void setup() |
484 | 487 | Serial.println(publish_Ack_Topic); |
485 | 488 | Serial.println("XXXXXXX"); |
486 | 489 | #endif |
| 490 | + // Setup SSID length is the length of the prefix, 'Krake_', which is 7 |
| 491 | + // plus the length of the MAC address string, MAC_ADDRESS_STRING_LENGTH |
| 492 | + const size_t SETUP_SSID_LENGTH = 7 + MAC_ADDRESS_STRING_LENGTH; |
| 493 | + char setupSsid[SETUP_SSID_LENGTH] = "Krake_"; |
| 494 | + strcat(setupSsid, macAddressString); |
487 | 495 |
|
488 | 496 | // We call this a second time to get the MAC on the screen |
489 | 497 | // clearLCD(); |
490 | 498 | // req for Wifi Man and OTA |
491 | | - char setupSsid[20] = "Krake_\0"; |
492 | | - strcat(setupSsid, macAddressString); |
493 | 499 |
|
494 | 500 | WiFiMan(setupSsid); |
495 | 501 | initLittleFS(); |
|
0 commit comments