forked from fmueller/esp8266-led-marquee-sign-controller
reformat comments
This commit is contained in:
parent
ad4ee16f19
commit
165540c120
@ -19,6 +19,7 @@ static SocketServer socketServer;
|
||||
#define AIO_SERVERPORT credentials::mqtt_port
|
||||
#define AIO_USERNAME credentials::mqtt_username.c_str()
|
||||
#define AIO_KEY credentials::mqtt_password.c_str()
|
||||
|
||||
WiFiClient client;
|
||||
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
|
||||
Adafruit_MQTT_Subscribe mqtt_subscribe_topic = Adafruit_MQTT_Subscribe(&mqtt, "homeassistant/marquee_sign/text");
|
||||
@ -90,7 +91,8 @@ void MQTT_connect() {
|
||||
}
|
||||
|
||||
uint8_t retries = 6;
|
||||
while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
|
||||
// connect will return 0 for connected
|
||||
while ((ret = mqtt.connect()) != 0) {
|
||||
mqtt.disconnect();
|
||||
|
||||
// wait 10s till next try
|
||||
|
12
src/util.h
12
src/util.h
@ -287,7 +287,8 @@ String convertToCP437(const String& input) {
|
||||
if ((ch & 0xF0) == 0xE0) {
|
||||
if (i + 2 < len) {
|
||||
uint32_t utf8_char = ((uint8_t)input[i] << 16) | ((uint8_t)input[i + 1] << 8) | (uint8_t)input[i + 2];
|
||||
i += 2; // skip 2 additional bytes
|
||||
// skip 2 additional bytes
|
||||
i += 2;
|
||||
if (cp437_map.find(utf8_char) != cp437_map.end()) {
|
||||
output += static_cast<char>(cp437_map[utf8_char]);
|
||||
continue;
|
||||
@ -298,7 +299,8 @@ String convertToCP437(const String& input) {
|
||||
else if ((ch & 0xE0) == 0xC0) {
|
||||
if (i + 1 < len) {
|
||||
uint16_t utf8_char = ((uint8_t)input[i] << 8) | (uint8_t)input[i + 1];
|
||||
i++; // skip second byte
|
||||
// skip second byte
|
||||
i++;
|
||||
if (cp437_map.find(utf8_char) != cp437_map.end()) {
|
||||
output += static_cast<char>(cp437_map[utf8_char]);
|
||||
continue;
|
||||
@ -306,11 +308,13 @@ String convertToCP437(const String& input) {
|
||||
}
|
||||
}
|
||||
// single UTF-16 character (or plain ANSI character)
|
||||
else if ((uint8_t)ch < 0x80) { // keep ASCII as is
|
||||
else if ((uint8_t)ch < 0x80) {
|
||||
// keep ASCII as is
|
||||
output += ch;
|
||||
}
|
||||
else {
|
||||
uint16_t utf16_char = (uint8_t)ch; // UTF-16 range
|
||||
uint16_t utf16_char = (uint8_t)ch;
|
||||
// check if character is in UTF-16 range, fallback to ?
|
||||
if (cp437_map.find(utf16_char) != cp437_map.end()) {
|
||||
output += static_cast<char>(cp437_map[utf16_char]);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user