mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 05:36:37 +00:00
Small speed optimizations
This commit is contained in:
parent
d5f6140736
commit
30299e879a
@ -204,7 +204,7 @@ static const uint8_t * lv_font_get_bitmap_fmt_zifont(const lv_font_t * font, uin
|
|||||||
/* Bitmap still in buffer */
|
/* Bitmap still in buffer */
|
||||||
if(charInBuffer == unicode_letter && charBitmap_p) {
|
if(charInBuffer == unicode_letter && charBitmap_p) {
|
||||||
// Serial.printf("CacheLetter %c\n", (char)(uint8_t)unicode_letter);
|
// Serial.printf("CacheLetter %c\n", (char)(uint8_t)unicode_letter);
|
||||||
Serial.printf("#%c", (char)(uint8_t)unicode_letter);
|
// Serial.printf("#%c", (char)(uint8_t)unicode_letter);
|
||||||
return charBitmap_p;
|
return charBitmap_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ static const uint8_t * lv_font_get_bitmap_fmt_zifont(const lv_font_t * font, uin
|
|||||||
lv_zifont_char_t * charInfo;
|
lv_zifont_char_t * charInfo;
|
||||||
/* Check Last Glyph in chache is valid and Matches currentGlyphID */
|
/* Check Last Glyph in chache is valid and Matches currentGlyphID */
|
||||||
if(fdsc->last_glyph_id == glyphID && fdsc->last_glyph_dsc && fdsc->last_glyph_dsc->width > 0) {
|
if(fdsc->last_glyph_id == glyphID && fdsc->last_glyph_dsc && fdsc->last_glyph_dsc->width > 0) {
|
||||||
Serial.print("@");
|
// Serial.print("@");
|
||||||
charInfo = fdsc->last_glyph_dsc;
|
charInfo = fdsc->last_glyph_dsc;
|
||||||
} else {
|
} else {
|
||||||
Serial.print("-");
|
Serial.print("-");
|
||||||
|
@ -14,7 +14,7 @@ void dispatchLoop()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
// objectattribute=value
|
// objectattribute=value
|
||||||
void dispatchAttribute(String & strTopic, String & strPayload)
|
void IRAM_ATTR dispatchAttribute(String & strTopic, String & strPayload)
|
||||||
{
|
{
|
||||||
if(strTopic.startsWith("p[")) {
|
if(strTopic.startsWith("p[")) {
|
||||||
String strPageId = strTopic.substring(2, strTopic.indexOf("]"));
|
String strPageId = strTopic.substring(2, strTopic.indexOf("]"));
|
||||||
@ -36,7 +36,7 @@ void dispatchAttribute(String & strTopic, String & strPayload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchPage(String & strPageid)
|
void IRAM_ATTR dispatchPage(String & strPageid)
|
||||||
{
|
{
|
||||||
debugPrintln("PAGE:" + strPageid);
|
debugPrintln("PAGE:" + strPageid);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ void dispatchPage(String & strPageid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchCommand(String cmnd)
|
void IRAM_ATTR dispatchCommand(String cmnd)
|
||||||
{
|
{
|
||||||
debugPrintln("CMND: " + cmnd);
|
debugPrintln("CMND: " + cmnd);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void dispatchCommand(String cmnd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchJson(String & strPayload)
|
void IRAM_ATTR dispatchJson(String & strPayload)
|
||||||
{ // Parse an incoming JSON array into individual commands
|
{ // Parse an incoming JSON array into individual commands
|
||||||
if(strPayload.endsWith(",]")) {
|
if(strPayload.endsWith(",]")) {
|
||||||
// Trailing null array elements are an artifact of older Home Assistant automations
|
// Trailing null array elements are an artifact of older Home Assistant automations
|
||||||
@ -110,7 +110,7 @@ void dispatchJson(String & strPayload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchIdle(const __FlashStringHelper * state)
|
void IRAM_ATTR dispatchIdle(const __FlashStringHelper * state)
|
||||||
{
|
{
|
||||||
mqttSendState(String(F("idle")).c_str(), String(state).c_str());
|
mqttSendState(String(F("idle")).c_str(), String(state).c_str());
|
||||||
}
|
}
|
@ -79,7 +79,7 @@ PubSubClient mqttClient(wifiClient);
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Send changed values OUT
|
// Send changed values OUT
|
||||||
|
|
||||||
void mqttSendState(const char * subtopic, const char * payload)
|
void IRAM_ATTR mqttSendState(const char * subtopic, const char * payload)
|
||||||
{
|
{
|
||||||
// page = 0
|
// page = 0
|
||||||
// p[0].b[0].attr = abc
|
// p[0].b[0].attr = abc
|
||||||
@ -101,26 +101,26 @@ void mqttSendState(const char * subtopic, const char * payload)
|
|||||||
debugPrintln(String(F("MQTT OUT: ")) + String(topic) + " = " + String(value));
|
debugPrintln(String(F("MQTT OUT: ")) + String(topic) + " = " + String(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqttSendNewValue(uint8_t pageid, uint8_t btnid, const char * attribute, String txt)
|
void IRAM_ATTR mqttSendNewValue(uint8_t pageid, uint8_t btnid, const char * attribute, String txt)
|
||||||
{
|
{
|
||||||
char subtopic[32];
|
char subtopic[32];
|
||||||
sprintf_P(subtopic, PSTR("p[%u].b[%u].%s"), pageid, btnid, attribute);
|
sprintf_P(subtopic, PSTR("p[%u].b[%u].%s"), pageid, btnid, attribute);
|
||||||
mqttSendState(subtopic, txt.c_str());
|
mqttSendState(subtopic, txt.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqttSendNewValue(uint8_t pageid, uint8_t btnid, int32_t val)
|
void IRAM_ATTR mqttSendNewValue(uint8_t pageid, uint8_t btnid, int32_t val)
|
||||||
{
|
{
|
||||||
char value[16];
|
char value[16];
|
||||||
itoa(val, value, 10);
|
itoa(val, value, 10);
|
||||||
mqttSendNewValue(pageid, btnid, "val", value);
|
mqttSendNewValue(pageid, btnid, "val", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqttSendNewValue(uint8_t pageid, uint8_t btnid, String txt)
|
void IRAM_ATTR mqttSendNewValue(uint8_t pageid, uint8_t btnid, String txt)
|
||||||
{
|
{
|
||||||
mqttSendNewValue(pageid, btnid, "txt", txt);
|
mqttSendNewValue(pageid, btnid, "txt", txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqttSendNewEvent(uint8_t pageid, uint8_t btnid, int32_t val)
|
void IRAM_ATTR mqttSendNewEvent(uint8_t pageid, uint8_t btnid, int32_t val)
|
||||||
{
|
{
|
||||||
char value[16];
|
char value[16];
|
||||||
itoa(val, value, 10);
|
itoa(val, value, 10);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user