v0.40
- fixes a bug in text lengths calculations with spaces - adds the onscreen menu option to disable or enable internal apps Many options are moved from webinterface to onscreen menu the last few versions. if you running awtrix light for some versions now, it could be necessary to delete your config.json and restart in order to cleanup your webinterface. closes #14
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "AWTRIX Light",
|
"name": "AWTRIX Light",
|
||||||
"version": "0.39",
|
"version": "0.40",
|
||||||
"home_assistant_domain": "AwtrixLight",
|
"home_assistant_domain": "AwtrixLight",
|
||||||
"funding_url": "https://blueforcer.de",
|
"funding_url": "https://blueforcer.de",
|
||||||
"new_install_prompt_erase": true,
|
"new_install_prompt_erase": true,
|
||||||
|
|||||||
@@ -17,5 +17,6 @@ Hold down the middle button for 2s to exit the current menu and to save your set
|
|||||||
| `DATE` | Allows selection of date format. |
|
| `DATE` | Allows selection of date format. |
|
||||||
| `WEEKDAY` | Allows selection of start of week. |
|
| `WEEKDAY` | Allows selection of start of week. |
|
||||||
| `TEMP` | Allows selection of temperature system (°C or °F). |
|
| `TEMP` | Allows selection of temperature system (°C or °F). |
|
||||||
|
| `APPS` | Allows to enable or disable internal apps |
|
||||||
| `UPDATE` | Check and download new firmware if available. |
|
| `UPDATE` | Check and download new firmware if available. |
|
||||||
|
|
||||||
|
|||||||
@@ -185,38 +185,42 @@ int8_t MatrixDisplayUi::update()
|
|||||||
void MatrixDisplayUi::tick()
|
void MatrixDisplayUi::tick()
|
||||||
{
|
{
|
||||||
this->state.ticksSinceLastStateSwitch++;
|
this->state.ticksSinceLastStateSwitch++;
|
||||||
switch (this->state.frameState)
|
|
||||||
{
|
|
||||||
case IN_TRANSITION:
|
|
||||||
if (this->state.ticksSinceLastStateSwitch >= this->ticksPerTransition)
|
|
||||||
{
|
|
||||||
this->state.frameState = FIXED;
|
|
||||||
this->state.currentFrame = getnextAppNumber();
|
|
||||||
this->state.ticksSinceLastStateSwitch = 0;
|
|
||||||
this->nextAppNumber = -1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FIXED:
|
|
||||||
// Revert manuelControll
|
|
||||||
if (this->state.manuelControll)
|
|
||||||
{
|
|
||||||
this->state.frameTransitionDirection = this->lastTransitionDirection;
|
|
||||||
this->state.manuelControll = false;
|
|
||||||
}
|
|
||||||
if (this->state.ticksSinceLastStateSwitch >= this->ticksPerFrame)
|
|
||||||
{
|
|
||||||
if (this->setAutoTransition)
|
|
||||||
{
|
|
||||||
|
|
||||||
this->state.frameState = IN_TRANSITION;
|
if (this->AppCount > 0)
|
||||||
|
{
|
||||||
|
switch (this->state.frameState)
|
||||||
|
{
|
||||||
|
case IN_TRANSITION:
|
||||||
|
if (this->state.ticksSinceLastStateSwitch >= this->ticksPerTransition)
|
||||||
|
{
|
||||||
|
this->state.frameState = FIXED;
|
||||||
|
this->state.currentFrame = getnextAppNumber();
|
||||||
|
this->state.ticksSinceLastStateSwitch = 0;
|
||||||
|
this->nextAppNumber = -1;
|
||||||
}
|
}
|
||||||
this->state.ticksSinceLastStateSwitch = 0;
|
break;
|
||||||
|
case FIXED:
|
||||||
|
// Revert manuelControll
|
||||||
|
if (this->state.manuelControll)
|
||||||
|
{
|
||||||
|
this->state.frameTransitionDirection = this->lastTransitionDirection;
|
||||||
|
this->state.manuelControll = false;
|
||||||
|
}
|
||||||
|
if (this->state.ticksSinceLastStateSwitch >= this->ticksPerFrame)
|
||||||
|
{
|
||||||
|
if (this->setAutoTransition)
|
||||||
|
{
|
||||||
|
this->state.frameState = IN_TRANSITION;
|
||||||
|
}
|
||||||
|
this->state.ticksSinceLastStateSwitch = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->matrix->clear();
|
this->matrix->clear();
|
||||||
this->drawApp();
|
if (this->AppCount > 0)
|
||||||
|
this->drawApp();
|
||||||
this->drawOverlays();
|
this->drawOverlays();
|
||||||
this->matrix->show();
|
this->matrix->show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ void DisplayManager_::drawJPG(uint16_t x, uint16_t y, fs::File jpgFile)
|
|||||||
TJpgDec.drawFsJpg(x, y, jpgFile);
|
TJpgDec.drawFsJpg(x, y, jpgFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisplayManager_::drawBMP(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h)
|
||||||
|
{
|
||||||
|
matrix.drawRGBBitmap(y, x, bitmap, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
void DisplayManager_::applyAllSettings()
|
void DisplayManager_::applyAllSettings()
|
||||||
{
|
{
|
||||||
ui.setTargetFPS(MATRIX_FPS);
|
ui.setTargetFPS(MATRIX_FPS);
|
||||||
@@ -219,21 +224,18 @@ void pushCustomFrame(String name, int position)
|
|||||||
|
|
||||||
void removeCustomFrame(const String &name)
|
void removeCustomFrame(const String &name)
|
||||||
{
|
{
|
||||||
// Suchen Sie nach dem Element, das dem Namen entspricht
|
|
||||||
auto it = std::find_if(Apps.begin(), Apps.end(), [&name](const std::pair<String, AppCallback> &appPair)
|
auto it = std::find_if(Apps.begin(), Apps.end(), [&name](const std::pair<String, AppCallback> &appPair)
|
||||||
{ return appPair.first == name; });
|
{ return appPair.first == name; });
|
||||||
|
|
||||||
// Wenn das Element gefunden wurde, entfernen Sie es aus dem Vektor
|
|
||||||
if (it != Apps.end())
|
if (it != Apps.end())
|
||||||
{
|
{
|
||||||
Apps.erase(it);
|
Apps.erase(it);
|
||||||
ui.setApps(Apps); // Aktualisieren Sie die Frames
|
ui.setApps(Apps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayManager_::generateCustomPage(String name, String payload)
|
void DisplayManager_::generateCustomPage(String name, String payload)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (payload == "" && customFrames.count(name))
|
if (payload == "" && customFrames.count(name))
|
||||||
{
|
{
|
||||||
customFrames.erase(customFrames.find(name));
|
customFrames.erase(customFrames.find(name));
|
||||||
@@ -261,7 +263,6 @@ void DisplayManager_::generateCustomPage(String name, String payload)
|
|||||||
customFrame.pushIcon = doc.containsKey("pushIcon") ? doc["pushIcon"] : 0;
|
customFrame.pushIcon = doc.containsKey("pushIcon") ? doc["pushIcon"] : 0;
|
||||||
customFrame.name = name;
|
customFrame.name = name;
|
||||||
customFrame.text = utf8ascii(doc["text"].as<String>());
|
customFrame.text = utf8ascii(doc["text"].as<String>());
|
||||||
|
|
||||||
customFrame.color = doc.containsKey("color") ? doc["color"].is<String>() ? hexToRgb565(doc["color"]) : doc["color"].is<JsonArray>() ? hexToRgb565(doc["color"].as<String>())
|
customFrame.color = doc.containsKey("color") ? doc["color"].is<String>() ? hexToRgb565(doc["color"]) : doc["color"].is<JsonArray>() ? hexToRgb565(doc["color"].as<String>())
|
||||||
: TEXTCOLOR_565
|
: TEXTCOLOR_565
|
||||||
: TEXTCOLOR_565;
|
: TEXTCOLOR_565;
|
||||||
@@ -342,25 +343,49 @@ void DisplayManager_::generateNotification(String payload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayManager_::loadApps()
|
void DisplayManager_::loadNativeApps()
|
||||||
{
|
{
|
||||||
Apps.clear();
|
// Define a helper function to check and update an app
|
||||||
Apps.push_back(std::make_pair("time", TimeFrame));
|
auto updateApp = [&](const String &name, AppCallback callback, bool show, size_t position)
|
||||||
if (SHOW_DATE)
|
{
|
||||||
Apps.push_back(std::make_pair("date", DateFrame));
|
auto it = std::find_if(Apps.begin(), Apps.end(), [&](const std::pair<String, AppCallback> &app)
|
||||||
if (SHOW_TEMP)
|
{ return app.first == name; });
|
||||||
Apps.push_back(std::make_pair("temp", TempFrame));
|
if (it != Apps.end())
|
||||||
if (SHOW_HUM)
|
{
|
||||||
Apps.push_back(std::make_pair("hum", HumFrame));
|
if (!show)
|
||||||
if (SHOW_BATTERY)
|
{
|
||||||
Apps.push_back(std::make_pair("bat", BatFrame));
|
Apps.erase(it);
|
||||||
// if (SHOW_WEATHER)
|
}
|
||||||
// Apps.push_back(std::make_pair(5, WeatherFrame));
|
}
|
||||||
nativeAppsCount = Apps.size();
|
else
|
||||||
ui.setApps(Apps); // Add frames
|
{
|
||||||
if (AUTO_TRANSITION && nativeAppsCount == 1)
|
if (show)
|
||||||
|
{
|
||||||
|
Apps.insert(Apps.begin() + position, std::make_pair(name, callback));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update the "time" app at position 0
|
||||||
|
updateApp("time", TimeFrame, SHOW_TIME, 0);
|
||||||
|
|
||||||
|
// Update the "date" app at position 1
|
||||||
|
updateApp("date", DateFrame, SHOW_DATE, 1);
|
||||||
|
|
||||||
|
// Update the "temp" app at position 2
|
||||||
|
updateApp("temp", TempFrame, SHOW_TEMP, 2);
|
||||||
|
|
||||||
|
// Update the "hum" app at position 3
|
||||||
|
updateApp("hum", HumFrame, SHOW_HUM, 3);
|
||||||
|
|
||||||
|
// Update the "bat" app at position 4
|
||||||
|
updateApp("bat", BatFrame, SHOW_BAT, 4);
|
||||||
|
|
||||||
|
ui.setApps(Apps);
|
||||||
|
if (AUTO_TRANSITION && Apps.size() == 1)
|
||||||
|
{
|
||||||
setAutoTransition(false);
|
setAutoTransition(false);
|
||||||
StartAppUpdater();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayManager_::setup()
|
void DisplayManager_::setup()
|
||||||
@@ -545,8 +570,8 @@ void DisplayManager_::drawProgressBar(int cur, int total)
|
|||||||
|
|
||||||
void DisplayManager_::drawMenuIndicator(int cur, int total)
|
void DisplayManager_::drawMenuIndicator(int cur, int total)
|
||||||
{
|
{
|
||||||
int menuItemWidth = 2;
|
int menuItemWidth = 1;
|
||||||
int totalWidth = total * menuItemWidth + (total - 2);
|
int totalWidth = total * menuItemWidth + (total - 1);
|
||||||
int leftMargin = (MATRIX_WIDTH - totalWidth) / 2;
|
int leftMargin = (MATRIX_WIDTH - totalWidth) / 2;
|
||||||
int pixelSpacing = 1;
|
int pixelSpacing = 1;
|
||||||
for (int i = 0; i < total; i++)
|
for (int i = 0; i < total; i++)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public:
|
|||||||
void rightButton();
|
void rightButton();
|
||||||
void dismissNotify();
|
void dismissNotify();
|
||||||
void HSVtext(int16_t, int16_t, const char *, bool);
|
void HSVtext(int16_t, int16_t, const char *, bool);
|
||||||
void loadApps();
|
void loadNativeApps();
|
||||||
void nextApp();
|
void nextApp();
|
||||||
void previousApp();
|
void previousApp();
|
||||||
void leftButton();
|
void leftButton();
|
||||||
@@ -55,6 +55,7 @@ public:
|
|||||||
void drawJPG(uint16_t x, uint16_t y, fs::File jpgFile);
|
void drawJPG(uint16_t x, uint16_t y, fs::File jpgFile);
|
||||||
void drawProgressBar(int cur, int total);
|
void drawProgressBar(int cur, int total);
|
||||||
void drawMenuIndicator(int cur, int total);
|
void drawMenuIndicator(int cur, int total);
|
||||||
|
void drawBMP(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DisplayManager_ &DisplayManager;
|
extern DisplayManager_ &DisplayManager;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ void TimeFrame(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x
|
|||||||
timeInfo = localtime(&now);
|
timeInfo = localtime(&now);
|
||||||
char t[20];
|
char t[20];
|
||||||
strftime(t, sizeof(t), TIME_FORMAT.c_str(), localtime(&now));
|
strftime(t, sizeof(t), TIME_FORMAT.c_str(), localtime(&now));
|
||||||
DisplayManager.printText(0 + x, 6 + y, t, true, true);
|
DisplayManager.printText(0 + x, 6 + y, t, true, false);
|
||||||
|
|
||||||
if (!SHOW_WEEKDAY)
|
if (!SHOW_WEEKDAY)
|
||||||
return;
|
return;
|
||||||
@@ -184,7 +184,7 @@ void HumFrame(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t x,
|
|||||||
return;
|
return;
|
||||||
CURRENT_APP = "Humidity";
|
CURRENT_APP = "Humidity";
|
||||||
DisplayManager.getInstance().resetTextColor();
|
DisplayManager.getInstance().resetTextColor();
|
||||||
matrix->drawRGBBitmap(x, y + 1, get_icon(2075), 8, 8);
|
matrix->drawRGBBitmap(x, y + 1, get_icon(2075), 8,8);
|
||||||
matrix->setCursor(14 + x, 6 + y);
|
matrix->setCursor(14 + x, 6 + y);
|
||||||
int humidity = CURRENT_HUM; // Temperatur ohne Nachkommastellen
|
int humidity = CURRENT_HUM; // Temperatur ohne Nachkommastellen
|
||||||
matrix->print(humidity); // Ausgabe der Temperatur
|
matrix->print(humidity); // Ausgabe der Temperatur
|
||||||
@@ -214,7 +214,6 @@ void MenuFrame(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state)
|
|||||||
void AlarmFrame(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state)
|
void AlarmFrame(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state)
|
||||||
{
|
{
|
||||||
if (ALARM_ACTIVE)
|
if (ALARM_ACTIVE)
|
||||||
|
|
||||||
{
|
{
|
||||||
matrix->fillScreen(matrix->Color(255, 0, 0));
|
matrix->fillScreen(matrix->Color(255, 0, 0));
|
||||||
CURRENT_APP = "Alarm";
|
CURRENT_APP = "Alarm";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <Globals.h>
|
#include <Globals.h>
|
||||||
|
|
||||||
std::map<char, uint16_t> CharMap = {
|
std::map<char, uint16_t> CharMap = {
|
||||||
{32, 3}, {33, 2}, {34, 4}, {35, 4}, {36, 4}, {37, 4}, {38, 4}, {39, 2}, {40, 3}, {41, 3}, {42, 4}, {43, 4}, {44, 3}, {45, 4}, {46, 2}, {47, 4}, {48, 4}, {49, 4}, {50, 4}, {51, 4}, {52, 4}, {53, 4}, {54, 4}, {55, 4}, {56, 4}, {57, 4}, {58, 2}, {59, 3}, {60, 4}, {61, 4}, {62, 4}, {63, 4}, {64, 4}, {65, 4}, {66, 4}, {67, 4}, {68, 4}, {69, 4}, {70, 4}, {71, 4}, {72, 4}, {73, 2}, {74, 4}, {75, 4}, {76, 4}, {77, 6}, {78, 5}, {79, 4}, {80, 4}, {81, 5}, {82, 4}, {83, 4}, {84, 4}, {85, 4}, {86, 4}, {87, 6}, {88, 4}, {89, 4}, {90, 4}, {91, 4}, {92, 4}, {93, 4}, {94, 4}, {95, 4}, {96, 3}, {97, 4}, {98, 4}, {99, 4}, {100, 4}, {101, 4}, {102, 4}, {103, 4}, {104, 4}, {105, 2}, {106, 4}, {107, 4}, {108, 4}, {109, 4}, {110, 4}, {111, 4}, {112, 4}, {113, 4}, {114, 4}, {115, 4}, {116, 4}, {117, 4}, {118, 4}, {119, 4}, {120, 4}, {121, 4}, {122, 4}, {123, 4}, {124, 2}, {125, 4}, {126, 4}, {161, 2}, {162, 4}, {163, 4}, {164, 4}, {165, 4}, {166, 2}, {167, 4}, {168, 4}, {169, 4}, {170, 4}, {171, 3}, {172, 4}, {173, 3}, {174, 4}, {175, 4}, {176, 4}, {177, 4}, {178, 4}, {179, 4}, {180, 3}, {181, 4}, {182, 4}, {183, 4}, {184, 4}, {185, 2}, {186, 4}, {187, 3}, {188, 4}, {189, 4}, {190, 4}, {191, 4}, {192, 4}, {193, 4}, {194, 4}, {195, 4}, {196, 4}, {197, 4}, {198, 4}, {199, 4}, {200, 4}, {201, 4}, {202, 4}, {203, 4}, {204, 4}, {205, 4}, {206, 4}, {207, 4}, {208, 4}, {209, 4}, {210, 4}, {211, 4}, {212, 4}, {213, 4}, {214, 4}, {215, 4}, {216, 4}, {217, 4}, {218, 4}, {219, 4}, {220, 4}, {221, 4}, {222, 4}, {223, 4}, {224, 4}, {225, 4}, {226, 4}, {227, 4}, {228, 4}, {229, 4}, {230, 4}, {231, 4}, {232, 4}, {233, 4}, {234, 4}, {235, 4}, {236, 3}, {237, 3}, {238, 4}, {239, 4}, {240, 4}, {241, 4}, {242, 4}, {243, 4}, {244, 4}, {245, 4}, {246, 4}, {247, 4}, {248, 4}, {249, 4}, {250, 4}, {251, 4}, {252, 4}, {253, 4}, {254, 4}, {255, 4}, {285, 2}, {338, 4}, {339, 4}, {352, 4}, {353, 4}, {376, 4}, {381, 4}, {382, 4}, {3748, 2}, {5024, 2}, {8226, 2}, {8230, 4}, {8364, 4}, {65533, 4}};
|
{32, 2}, {33, 2}, {34, 4}, {35, 4}, {36, 4}, {37, 4}, {38, 4}, {39, 2}, {40, 3}, {41, 3}, {42, 4}, {43, 4}, {44, 3}, {45, 4}, {46, 2}, {47, 4}, {48, 4}, {49, 4}, {50, 4}, {51, 4}, {52, 4}, {53, 4}, {54, 4}, {55, 4}, {56, 4}, {57, 4}, {58, 2}, {59, 3}, {60, 4}, {61, 4}, {62, 4}, {63, 4}, {64, 4}, {65, 4}, {66, 4}, {67, 4}, {68, 4}, {69, 4}, {70, 4}, {71, 4}, {72, 4}, {73, 2}, {74, 4}, {75, 4}, {76, 4}, {77, 6}, {78, 5}, {79, 4}, {80, 4}, {81, 5}, {82, 4}, {83, 4}, {84, 4}, {85, 4}, {86, 4}, {87, 6}, {88, 4}, {89, 4}, {90, 4}, {91, 4}, {92, 4}, {93, 4}, {94, 4}, {95, 4}, {96, 3}, {97, 4}, {98, 4}, {99, 4}, {100, 4}, {101, 4}, {102, 4}, {103, 4}, {104, 4}, {105, 2}, {106, 4}, {107, 4}, {108, 4}, {109, 4}, {110, 4}, {111, 4}, {112, 4}, {113, 4}, {114, 4}, {115, 4}, {116, 4}, {117, 4}, {118, 4}, {119, 4}, {120, 4}, {121, 4}, {122, 4}, {123, 4}, {124, 2}, {125, 4}, {126, 4}, {161, 2}, {162, 4}, {163, 4}, {164, 4}, {165, 4}, {166, 2}, {167, 4}, {168, 4}, {169, 4}, {170, 4}, {171, 3}, {172, 4}, {173, 3}, {174, 4}, {175, 4}, {176, 4}, {177, 4}, {178, 4}, {179, 4}, {180, 3}, {181, 4}, {182, 4}, {183, 4}, {184, 4}, {185, 2}, {186, 4}, {187, 3}, {188, 4}, {189, 4}, {190, 4}, {191, 4}, {192, 4}, {193, 4}, {194, 4}, {195, 4}, {196, 4}, {197, 4}, {198, 4}, {199, 4}, {200, 4}, {201, 4}, {202, 4}, {203, 4}, {204, 4}, {205, 4}, {206, 4}, {207, 4}, {208, 4}, {209, 4}, {210, 4}, {211, 4}, {212, 4}, {213, 4}, {214, 4}, {215, 4}, {216, 4}, {217, 4}, {218, 4}, {219, 4}, {220, 4}, {221, 4}, {222, 4}, {223, 4}, {224, 4}, {225, 4}, {226, 4}, {227, 4}, {228, 4}, {229, 4}, {230, 4}, {231, 4}, {232, 4}, {233, 4}, {234, 4}, {235, 4}, {236, 3}, {237, 3}, {238, 4}, {239, 4}, {240, 4}, {241, 4}, {242, 4}, {243, 4}, {244, 4}, {245, 4}, {246, 4}, {247, 4}, {248, 4}, {249, 4}, {250, 4}, {251, 4}, {252, 4}, {253, 4}, {254, 4}, {255, 4}, {285, 2}, {338, 4}, {339, 4}, {352, 4}, {353, 4}, {376, 4}, {381, 4}, {382, 4}, {3748, 2}, {5024, 2}, {8226, 2}, {8230, 4}, {8364, 4}, {65533, 4}};
|
||||||
|
|
||||||
uint32_t hsvToRgb(uint8_t h, uint8_t s, uint8_t v)
|
uint32_t hsvToRgb(uint8_t h, uint8_t s, uint8_t v)
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,8 @@ uint16_t hexToRgb565(String hexValue)
|
|||||||
uint8_t r = strtol(hexValue.substring(0, 2).c_str(), NULL, 16);
|
uint8_t r = strtol(hexValue.substring(0, 2).c_str(), NULL, 16);
|
||||||
uint8_t g = strtol(hexValue.substring(2, 4).c_str(), NULL, 16);
|
uint8_t g = strtol(hexValue.substring(2, 4).c_str(), NULL, 16);
|
||||||
uint8_t b = strtol(hexValue.substring(4, 6).c_str(), NULL, 16);
|
uint8_t b = strtol(hexValue.substring(4, 6).c_str(), NULL, 16);
|
||||||
if ((errno == ERANGE) || (r > 255) || (g > 255) || (b > 255)) {
|
if ((errno == ERANGE) || (r > 255) || (g > 255) || (b > 255))
|
||||||
|
{
|
||||||
return 0xFFFF;
|
return 0xFFFF;
|
||||||
}
|
}
|
||||||
uint16_t color = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
|
uint16_t color = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ private:
|
|||||||
long lastFrameTime;
|
long lastFrameTime;
|
||||||
bool firstFrameDone;
|
bool firstFrameDone;
|
||||||
int newframeDelay;
|
int newframeDelay;
|
||||||
int lastFrame[8 * 8];
|
int lastFrame[8 * 8];
|
||||||
bool lastFrameDrawn = false;
|
bool lastFrameDrawn = false;
|
||||||
unsigned long nextFrameTime = 0;
|
unsigned long nextFrameTime = 0;
|
||||||
#define GIFHDRTAGNORM "GIF87a"
|
#define GIFHDRTAGNORM "GIF87a"
|
||||||
#define GIFHDRTAGNORM1 "GIF89a"
|
#define GIFHDRTAGNORM1 "GIF89a"
|
||||||
#define GIFHDRSIZE 6
|
#define GIFHDRSIZE 6
|
||||||
FastLED_NeoMatrix *mtx;
|
FastLED_NeoMatrix *mtx;
|
||||||
@@ -528,6 +528,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
needNewFrame = false;
|
needNewFrame = false;
|
||||||
|
lastFrameTime = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -595,15 +596,12 @@ public:
|
|||||||
if (!file)
|
if (!file)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unsigned long now = millis();
|
if (millis() - lastFrameTime < newframeDelay)
|
||||||
|
|
||||||
if (now - lastFrameTime < newframeDelay)
|
|
||||||
{
|
{
|
||||||
redrawLastFrame();
|
redrawLastFrame();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastFrameTime = now;
|
|
||||||
lastFrameDrawn = false;
|
lastFrameDrawn = false;
|
||||||
|
|
||||||
offsetX = x;
|
offsetX = x;
|
||||||
@@ -614,8 +612,9 @@ public:
|
|||||||
byte b = readByte();
|
byte b = readByte();
|
||||||
if (b == 0x2c)
|
if (b == 0x2c)
|
||||||
{
|
{
|
||||||
unsigned int fdelay = parseTableBasedImage();
|
Serial.println("Parse");
|
||||||
return fdelay;
|
parseTableBasedImage();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else if (b == 0x21)
|
else if (b == 0x21)
|
||||||
{
|
{
|
||||||
@@ -641,12 +640,12 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
backUpStream(1);
|
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
|
Serial.println("Finished");
|
||||||
parseGifHeader();
|
parseGifHeader();
|
||||||
parseLogicalScreenDescriptor();
|
parseLogicalScreenDescriptor();
|
||||||
parseGlobalColorTable();
|
parseGlobalColorTable();
|
||||||
drawFrame(offsetX, offsetY);
|
drawFrame(offsetX,offsetY);
|
||||||
return ERROR_FINISHED;
|
return ERROR_FINISHED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ void loadSettings()
|
|||||||
DATE_FORMAT = Settings.getString("DFORMAT", "%d.%m.%y");
|
DATE_FORMAT = Settings.getString("DFORMAT", "%d.%m.%y");
|
||||||
START_ON_MONDAY = Settings.getBool("SOM", true);
|
START_ON_MONDAY = Settings.getBool("SOM", true);
|
||||||
IS_CELSIUS = Settings.getBool("CEL", true);
|
IS_CELSIUS = Settings.getBool("CEL", true);
|
||||||
|
SHOW_TIME = Settings.getBool("TIM", true);
|
||||||
|
SHOW_DATE = Settings.getBool("DAT", true);
|
||||||
|
SHOW_TEMP = Settings.getBool("TEMP", true);
|
||||||
|
SHOW_HUM = Settings.getBool("HUM", true);
|
||||||
|
SHOW_BAT = Settings.getBool("BAT", true);
|
||||||
Settings.end();
|
Settings.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +39,12 @@ void saveSettings()
|
|||||||
Settings.putString("DFORMAT", DATE_FORMAT);
|
Settings.putString("DFORMAT", DATE_FORMAT);
|
||||||
Settings.putBool("SOM", START_ON_MONDAY);
|
Settings.putBool("SOM", START_ON_MONDAY);
|
||||||
Settings.putBool("CEL", IS_CELSIUS);
|
Settings.putBool("CEL", IS_CELSIUS);
|
||||||
|
|
||||||
|
Settings.putBool("TIM", SHOW_TIME);
|
||||||
|
Settings.putBool("DAT", SHOW_DATE);
|
||||||
|
Settings.putBool("TEMP", SHOW_TEMP);
|
||||||
|
Settings.putBool("HUM", SHOW_HUM);
|
||||||
|
Settings.putBool("BAT", SHOW_BAT);
|
||||||
Settings.end();
|
Settings.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +53,7 @@ IPAddress gateway;
|
|||||||
IPAddress subnet;
|
IPAddress subnet;
|
||||||
IPAddress primaryDNS;
|
IPAddress primaryDNS;
|
||||||
IPAddress secondaryDNS;
|
IPAddress secondaryDNS;
|
||||||
const char *VERSION = "0.39";
|
const char *VERSION = "0.40";
|
||||||
String MQTT_HOST = "";
|
String MQTT_HOST = "";
|
||||||
uint16_t MQTT_PORT = 1883;
|
uint16_t MQTT_PORT = 1883;
|
||||||
String MQTT_USER;
|
String MQTT_USER;
|
||||||
@@ -51,9 +62,10 @@ String MQTT_PREFIX = "AwtrixLight";
|
|||||||
String CITY = "Berlin,de";
|
String CITY = "Berlin,de";
|
||||||
bool IO_BROKER = false;
|
bool IO_BROKER = false;
|
||||||
bool NET_STATIC = false;
|
bool NET_STATIC = false;
|
||||||
|
bool SHOW_TIME = true;
|
||||||
bool SHOW_DATE = true;
|
bool SHOW_DATE = true;
|
||||||
bool SHOW_WEATHER = true;
|
bool SHOW_WEATHER = true;
|
||||||
bool SHOW_BATTERY = true;
|
bool SHOW_BAT = true;
|
||||||
bool SHOW_TEMP = true;
|
bool SHOW_TEMP = true;
|
||||||
bool SHOW_HUM = true;
|
bool SHOW_HUM = true;
|
||||||
bool SHOW_SECONDS = true;
|
bool SHOW_SECONDS = true;
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ extern String MQTT_PREFIX;
|
|||||||
extern String CITY;
|
extern String CITY;
|
||||||
extern bool IO_BROKER;
|
extern bool IO_BROKER;
|
||||||
extern bool NET_STATIC;
|
extern bool NET_STATIC;
|
||||||
|
extern bool SHOW_TIME;
|
||||||
extern bool SHOW_DATE;
|
extern bool SHOW_DATE;
|
||||||
extern bool SHOW_WEATHER;
|
extern bool SHOW_WEATHER;
|
||||||
extern bool SHOW_BATTERY;
|
extern bool SHOW_BAT;
|
||||||
extern bool SHOW_TEMP;
|
extern bool SHOW_TEMP;
|
||||||
extern bool SHOW_HUM;
|
extern bool SHOW_HUM;
|
||||||
extern bool SHOW_SECONDS;
|
extern bool SHOW_SECONDS;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <ServerManager.h>
|
#include <ServerManager.h>
|
||||||
#include <DisplayManager.h>
|
#include <DisplayManager.h>
|
||||||
#include <updater.h>
|
#include <updater.h>
|
||||||
|
#include <icons.h>
|
||||||
|
|
||||||
String menuText;
|
String menuText;
|
||||||
int menuSelection;
|
int menuSelection;
|
||||||
@@ -23,7 +24,8 @@ enum MenuState
|
|||||||
TimeFormatMenu,
|
TimeFormatMenu,
|
||||||
DateFormatMenu,
|
DateFormatMenu,
|
||||||
WeekdayMenu,
|
WeekdayMenu,
|
||||||
TempMenu
|
TempMenu,
|
||||||
|
Appmenu,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *menuItems[] PROGMEM = {
|
const char *menuItems[] PROGMEM = {
|
||||||
@@ -37,10 +39,11 @@ const char *menuItems[] PROGMEM = {
|
|||||||
"DATE",
|
"DATE",
|
||||||
"WEEKDAY",
|
"WEEKDAY",
|
||||||
"TEMP",
|
"TEMP",
|
||||||
|
"APPS",
|
||||||
"UPDATE"};
|
"UPDATE"};
|
||||||
|
|
||||||
int8_t menuIndex = 0;
|
int8_t menuIndex = 0;
|
||||||
uint8_t menuItemCount = 11;
|
uint8_t menuItemCount = 12;
|
||||||
|
|
||||||
const char *timeFormat[] PROGMEM = {
|
const char *timeFormat[] PROGMEM = {
|
||||||
"%H:%M:%S",
|
"%H:%M:%S",
|
||||||
@@ -65,6 +68,16 @@ const char *dateFormat[] PROGMEM = {
|
|||||||
int8_t dateFormatIndex;
|
int8_t dateFormatIndex;
|
||||||
uint8_t dateFormatCount = 9;
|
uint8_t dateFormatCount = 9;
|
||||||
|
|
||||||
|
const char *appsItems[][2] PROGMEM = {
|
||||||
|
{"13", "time"},
|
||||||
|
{"1158", "date"},
|
||||||
|
{"234", "temp"},
|
||||||
|
{"2075", "hum"},
|
||||||
|
{"1486", "bat"}};
|
||||||
|
|
||||||
|
int8_t appsIndex;
|
||||||
|
uint8_t appsCount = 5;
|
||||||
|
|
||||||
MenuState currentState = MainMenu;
|
MenuState currentState = MainMenu;
|
||||||
|
|
||||||
uint16_t textColors[] PROGMEM = {
|
uint16_t textColors[] PROGMEM = {
|
||||||
@@ -95,71 +108,60 @@ MenuManager_ &MenuManager = MenuManager.getInstance();
|
|||||||
|
|
||||||
String MenuManager_::menutext()
|
String MenuManager_::menutext()
|
||||||
{
|
{
|
||||||
if (currentState == MainMenu)
|
time_t now = time(nullptr);
|
||||||
|
char t[20];
|
||||||
|
switch (currentState)
|
||||||
{
|
{
|
||||||
|
case MainMenu:
|
||||||
DisplayManager.drawMenuIndicator(menuIndex, menuItemCount);
|
DisplayManager.drawMenuIndicator(menuIndex, menuItemCount);
|
||||||
return (menuItems[menuIndex]);
|
return menuItems[menuIndex];
|
||||||
}
|
case BrightnessMenu:
|
||||||
else if (currentState == BrightnessMenu)
|
return AUTO_BRIGHTNESS ? "AUTO" : String(BRIGHTNESS_PERCENT) + "%";
|
||||||
{
|
case FPSMenu:
|
||||||
if (AUTO_BRIGHTNESS)
|
|
||||||
{
|
|
||||||
return ("AUTO");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (String(BRIGHTNESS_PERCENT) + "%");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == FPSMenu)
|
|
||||||
{
|
|
||||||
return String(MATRIX_FPS) + " FPS";
|
return String(MATRIX_FPS) + " FPS";
|
||||||
}
|
case ColorMenu:
|
||||||
else if (currentState == ColorMenu)
|
|
||||||
{
|
|
||||||
DisplayManager.setTextColor(textColors[currentColor]);
|
DisplayManager.setTextColor(textColors[currentColor]);
|
||||||
String colorStr = String(textColors[currentColor], HEX);
|
return "0x" + String(textColors[currentColor], HEX);
|
||||||
while (colorStr.length() < 4)
|
case SwitchMenu:
|
||||||
{
|
|
||||||
colorStr = "0" + colorStr;
|
|
||||||
}
|
|
||||||
return colorStr;
|
|
||||||
}
|
|
||||||
else if (currentState == SwitchMenu)
|
|
||||||
{
|
|
||||||
return AUTO_TRANSITION ? "ON" : "OFF";
|
return AUTO_TRANSITION ? "ON" : "OFF";
|
||||||
}
|
case TspeedMenu:
|
||||||
else if (currentState == TspeedMenu)
|
return String(TIME_PER_TRANSITION / 1000.0, 1) + "s";
|
||||||
{
|
case AppTimeMenu:
|
||||||
float seconds = (float)TIME_PER_TRANSITION / 1000.0;
|
return String(TIME_PER_APP / 1000.0, 0) + "s";
|
||||||
return String(seconds, 1) + "s";
|
case TimeFormatMenu:
|
||||||
}
|
|
||||||
else if (currentState == AppTimeMenu)
|
|
||||||
{
|
|
||||||
float seconds = (float)TIME_PER_APP / 1000.0;
|
|
||||||
return String(seconds, 0) + "s";
|
|
||||||
}
|
|
||||||
else if (currentState == TimeFormatMenu)
|
|
||||||
{
|
|
||||||
time_t now = time(nullptr);
|
|
||||||
char t[20];
|
|
||||||
strftime(t, sizeof(t), timeFormat[timeFormatIndex], localtime(&now));
|
strftime(t, sizeof(t), timeFormat[timeFormatIndex], localtime(&now));
|
||||||
return t;
|
return t;
|
||||||
}
|
case DateFormatMenu:
|
||||||
else if (currentState == DateFormatMenu)
|
|
||||||
{
|
|
||||||
time_t now = time(nullptr);
|
|
||||||
char t[20];
|
|
||||||
strftime(t, sizeof(t), dateFormat[dateFormatIndex], localtime(&now));
|
strftime(t, sizeof(t), dateFormat[dateFormatIndex], localtime(&now));
|
||||||
return t;
|
return t;
|
||||||
}
|
case WeekdayMenu:
|
||||||
else if (currentState == WeekdayMenu)
|
|
||||||
{
|
|
||||||
return START_ON_MONDAY ? "MON" : "SUN";
|
return START_ON_MONDAY ? "MON" : "SUN";
|
||||||
}
|
case TempMenu:
|
||||||
else if (currentState == TempMenu)
|
|
||||||
{
|
|
||||||
return IS_CELSIUS ? "°C" : "°F";
|
return IS_CELSIUS ? "°C" : "°F";
|
||||||
|
case Appmenu:
|
||||||
|
switch (appsIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
DisplayManager.drawBMP(0, 0, get_icon(13), 8, 8);
|
||||||
|
return SHOW_TIME ? "ON" : "OFF";
|
||||||
|
case 1:
|
||||||
|
DisplayManager.drawBMP(0, 0, get_icon(1158), 8, 8);
|
||||||
|
return SHOW_DATE ? "ON" : "OFF";
|
||||||
|
case 2:
|
||||||
|
DisplayManager.drawBMP(0, 0, get_icon(234), 8, 8);
|
||||||
|
return SHOW_TEMP ? "ON" : "OFF";
|
||||||
|
case 3:
|
||||||
|
DisplayManager.drawBMP(0, 0, get_icon(2075), 8, 8);
|
||||||
|
return SHOW_HUM ? "ON" : "OFF";
|
||||||
|
case 4:
|
||||||
|
DisplayManager.drawBMP(0, 0, get_icon(1486), 8, 8);
|
||||||
|
return SHOW_BAT ? "ON" : "OFF";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -168,205 +170,199 @@ void MenuManager_::rightButton()
|
|||||||
{
|
{
|
||||||
if (!inMenu)
|
if (!inMenu)
|
||||||
return;
|
return;
|
||||||
if (currentState == MainMenu)
|
switch (currentState)
|
||||||
{
|
|
||||||
menuIndex++;
|
|
||||||
if (menuIndex > menuItemCount - 1)
|
|
||||||
{
|
|
||||||
menuIndex = 0; // Wrap around to the first menu item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == BrightnessMenu)
|
|
||||||
{
|
{
|
||||||
|
case MainMenu:
|
||||||
|
menuIndex = (menuIndex + 1) % menuItemCount;
|
||||||
|
break;
|
||||||
|
case BrightnessMenu:
|
||||||
if (!AUTO_BRIGHTNESS)
|
if (!AUTO_BRIGHTNESS)
|
||||||
{
|
{
|
||||||
++BRIGHTNESS_PERCENT;
|
BRIGHTNESS_PERCENT = (BRIGHTNESS_PERCENT % 100) + 1;
|
||||||
if (BRIGHTNESS_PERCENT > 100)
|
|
||||||
BRIGHTNESS_PERCENT = 1;
|
|
||||||
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
||||||
DisplayManager.setBrightness(BRIGHTNESS);
|
DisplayManager.setBrightness(BRIGHTNESS);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if (currentState == FPSMenu)
|
case FPSMenu:
|
||||||
{
|
|
||||||
if (MATRIX_FPS < 30)
|
if (MATRIX_FPS < 30)
|
||||||
++MATRIX_FPS;
|
++MATRIX_FPS;
|
||||||
}
|
break;
|
||||||
else if (currentState == ColorMenu)
|
case ColorMenu:
|
||||||
{
|
currentColor = (currentColor + 1) % (sizeof(textColors) / sizeof(textColors[0]));
|
||||||
int arraySize = sizeof(textColors) / sizeof(textColors[0]);
|
break;
|
||||||
currentColor = (currentColor + 1) % arraySize;
|
case SwitchMenu:
|
||||||
}
|
|
||||||
else if (currentState == SwitchMenu)
|
|
||||||
{
|
|
||||||
AUTO_TRANSITION = !AUTO_TRANSITION;
|
AUTO_TRANSITION = !AUTO_TRANSITION;
|
||||||
}
|
break;
|
||||||
else if (currentState == TspeedMenu)
|
case TspeedMenu:
|
||||||
{
|
|
||||||
TIME_PER_TRANSITION = min(1200, TIME_PER_TRANSITION + 100);
|
TIME_PER_TRANSITION = min(1200, TIME_PER_TRANSITION + 100);
|
||||||
}
|
break;
|
||||||
else if (currentState == AppTimeMenu)
|
case AppTimeMenu:
|
||||||
{
|
|
||||||
TIME_PER_APP = min(30000, TIME_PER_APP + 1000);
|
TIME_PER_APP = min(30000, TIME_PER_APP + 1000);
|
||||||
}
|
break;
|
||||||
else if (currentState == TimeFormatMenu)
|
case TimeFormatMenu:
|
||||||
{
|
timeFormatIndex = (timeFormatIndex + 1) % timeFormatCount;
|
||||||
timeFormatIndex++;
|
break;
|
||||||
if (timeFormatIndex > timeFormatCount - 1)
|
case DateFormatMenu:
|
||||||
{
|
dateFormatIndex = (dateFormatIndex + 1) % dateFormatCount;
|
||||||
timeFormatIndex = 0; // Wrap around to the first menu item
|
break;
|
||||||
}
|
case Appmenu:
|
||||||
}
|
appsIndex = (appsIndex + 1) % appsCount;
|
||||||
else if (currentState == DateFormatMenu)
|
break;
|
||||||
{
|
case WeekdayMenu:
|
||||||
dateFormatIndex++;
|
|
||||||
if (dateFormatIndex > dateFormatCount - 1)
|
|
||||||
{
|
|
||||||
dateFormatIndex = 0; // Wrap around to the first menu item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == WeekdayMenu)
|
|
||||||
{
|
|
||||||
START_ON_MONDAY = !START_ON_MONDAY;
|
START_ON_MONDAY = !START_ON_MONDAY;
|
||||||
}
|
break;
|
||||||
else if (currentState == TempMenu)
|
case TempMenu:
|
||||||
{
|
|
||||||
IS_CELSIUS = !IS_CELSIUS;
|
IS_CELSIUS = !IS_CELSIUS;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager_::leftButton()
|
void MenuManager_::leftButton()
|
||||||
{
|
{
|
||||||
if (!inMenu)
|
if (!inMenu)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
if (currentState == MainMenu)
|
|
||||||
{
|
|
||||||
menuIndex--;
|
|
||||||
if (menuIndex < 0)
|
|
||||||
{
|
|
||||||
menuIndex = menuItemCount - 1; // Wrap around to the last menu item
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (currentState == BrightnessMenu)
|
switch (currentState)
|
||||||
{
|
{
|
||||||
|
case MainMenu:
|
||||||
|
menuIndex = (menuIndex == 0) ? menuItemCount - 1 : menuIndex - 1;
|
||||||
|
break;
|
||||||
|
case BrightnessMenu:
|
||||||
if (!AUTO_BRIGHTNESS)
|
if (!AUTO_BRIGHTNESS)
|
||||||
{
|
{
|
||||||
--BRIGHTNESS_PERCENT;
|
BRIGHTNESS_PERCENT = (BRIGHTNESS_PERCENT == 1) ? 100 : BRIGHTNESS_PERCENT - 1;
|
||||||
if (BRIGHTNESS_PERCENT < 1)
|
|
||||||
BRIGHTNESS_PERCENT = 100;
|
|
||||||
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
||||||
DisplayManager.setBrightness(BRIGHTNESS);
|
DisplayManager.setBrightness(BRIGHTNESS);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if (currentState == FPSMenu)
|
case FPSMenu:
|
||||||
{
|
|
||||||
if (MATRIX_FPS > 15)
|
if (MATRIX_FPS > 15)
|
||||||
--MATRIX_FPS;
|
{
|
||||||
}
|
MATRIX_FPS--;
|
||||||
else if (currentState == ColorMenu)
|
}
|
||||||
{
|
break;
|
||||||
int arraySize = sizeof(textColors) / sizeof(textColors[0]);
|
case ColorMenu:
|
||||||
currentColor = (currentColor - 1 + arraySize) % arraySize;
|
currentColor = (currentColor + sizeof(textColors) / sizeof(textColors[0]) - 1) % (sizeof(textColors) / sizeof(textColors[0]));
|
||||||
}
|
break;
|
||||||
else if (currentState == SwitchMenu)
|
case SwitchMenu:
|
||||||
{
|
|
||||||
AUTO_TRANSITION = !AUTO_TRANSITION;
|
AUTO_TRANSITION = !AUTO_TRANSITION;
|
||||||
}
|
break;
|
||||||
else if (currentState == TspeedMenu)
|
case TspeedMenu:
|
||||||
{
|
|
||||||
TIME_PER_TRANSITION = max(200, TIME_PER_TRANSITION - 100);
|
TIME_PER_TRANSITION = max(200, TIME_PER_TRANSITION - 100);
|
||||||
}
|
break;
|
||||||
else if (currentState == AppTimeMenu)
|
case AppTimeMenu:
|
||||||
{
|
|
||||||
TIME_PER_APP = max(1000, TIME_PER_APP - 1000);
|
TIME_PER_APP = max(1000, TIME_PER_APP - 1000);
|
||||||
}
|
break;
|
||||||
else if (currentState == TimeFormatMenu)
|
case TimeFormatMenu:
|
||||||
{
|
timeFormatIndex = (timeFormatIndex == 0) ? timeFormatCount - 1 : timeFormatIndex - 1;
|
||||||
timeFormatIndex--;
|
break;
|
||||||
if (timeFormatIndex < 0)
|
case DateFormatMenu:
|
||||||
{
|
dateFormatIndex = (dateFormatIndex == 0) ? dateFormatCount - 1 : dateFormatIndex - 1;
|
||||||
timeFormatIndex = timeFormatCount - 1;
|
break;
|
||||||
}
|
case Appmenu:
|
||||||
}
|
appsIndex = (appsIndex == 0) ? appsCount - 1 : appsIndex - 1;
|
||||||
else if (currentState == DateFormatMenu)
|
break;
|
||||||
{
|
case WeekdayMenu:
|
||||||
dateFormatIndex--;
|
|
||||||
if (dateFormatIndex < 0)
|
|
||||||
{
|
|
||||||
dateFormatIndex = dateFormatCount - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (currentState == WeekdayMenu)
|
|
||||||
{
|
|
||||||
START_ON_MONDAY = !START_ON_MONDAY;
|
START_ON_MONDAY = !START_ON_MONDAY;
|
||||||
}
|
break;
|
||||||
else if (currentState == TempMenu)
|
case TempMenu:
|
||||||
{
|
|
||||||
IS_CELSIUS = !IS_CELSIUS;
|
IS_CELSIUS = !IS_CELSIUS;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuManager_::selectButton()
|
void MenuManager_::selectButton()
|
||||||
{
|
{
|
||||||
if (!inMenu)
|
if (!inMenu)
|
||||||
return;
|
|
||||||
if (currentState == MainMenu)
|
|
||||||
{
|
{
|
||||||
if (menuIndex == 0) // BRIGHT
|
return;
|
||||||
|
}
|
||||||
|
switch (currentState)
|
||||||
|
{
|
||||||
|
case MainMenu:
|
||||||
|
switch (menuIndex)
|
||||||
{
|
{
|
||||||
|
case 0:
|
||||||
BRIGHTNESS_PERCENT = map(BRIGHTNESS, 0, 255, 0, 100);
|
BRIGHTNESS_PERCENT = map(BRIGHTNESS, 0, 255, 0, 100);
|
||||||
currentState = BrightnessMenu;
|
currentState = BrightnessMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 1) // RESET
|
case 1:
|
||||||
{
|
|
||||||
currentState = FPSMenu;
|
currentState = FPSMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 2) // COLOR
|
case 2:
|
||||||
{
|
|
||||||
currentState = ColorMenu;
|
currentState = ColorMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 3) // COLOR
|
case 3:
|
||||||
{
|
|
||||||
currentState = SwitchMenu;
|
currentState = SwitchMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 4) // TSPEED
|
case 4:
|
||||||
{
|
|
||||||
currentState = TspeedMenu;
|
currentState = TspeedMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 5) // AppTIme
|
case 5:
|
||||||
{
|
|
||||||
currentState = AppTimeMenu;
|
currentState = AppTimeMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 6) // Time
|
case 6:
|
||||||
{
|
|
||||||
currentState = TimeFormatMenu;
|
currentState = TimeFormatMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 7) // date
|
case 7:
|
||||||
{
|
|
||||||
currentState = DateFormatMenu;
|
currentState = DateFormatMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 8) // weekday
|
case 8:
|
||||||
{
|
|
||||||
currentState = WeekdayMenu;
|
currentState = WeekdayMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 9) // temp
|
case 9:
|
||||||
{
|
|
||||||
currentState = TempMenu;
|
currentState = TempMenu;
|
||||||
}
|
break;
|
||||||
else if (menuIndex == 10) // Updater
|
case 10:
|
||||||
{
|
currentState = Appmenu;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
if (FirmwareVersionCheck())
|
if (FirmwareVersionCheck())
|
||||||
|
{
|
||||||
updateFirmware();
|
updateFirmware();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if (currentState == BrightnessMenu)
|
case BrightnessMenu:
|
||||||
{
|
|
||||||
AUTO_BRIGHTNESS = !AUTO_BRIGHTNESS;
|
AUTO_BRIGHTNESS = !AUTO_BRIGHTNESS;
|
||||||
if (!AUTO_BRIGHTNESS)
|
if (!AUTO_BRIGHTNESS)
|
||||||
{
|
{
|
||||||
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
||||||
DisplayManager.setBrightness(BRIGHTNESS);
|
DisplayManager.setBrightness(BRIGHTNESS);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case Appmenu:
|
||||||
|
switch (appsIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
SHOW_TIME = !SHOW_TIME;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
SHOW_DATE = !SHOW_DATE;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
SHOW_TEMP = !SHOW_TEMP;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
SHOW_HUM = !SHOW_HUM;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
SHOW_BAT = !SHOW_BAT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,57 +370,47 @@ void MenuManager_::selectButtonLong()
|
|||||||
{
|
{
|
||||||
if (inMenu)
|
if (inMenu)
|
||||||
{
|
{
|
||||||
if (currentState == BrightnessMenu)
|
switch (currentState)
|
||||||
{
|
{
|
||||||
|
case BrightnessMenu:
|
||||||
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
BRIGHTNESS = map(BRIGHTNESS_PERCENT, 0, 100, 0, 255);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
break;
|
||||||
else if (currentState == FPSMenu)
|
case FPSMenu:
|
||||||
{
|
|
||||||
DisplayManager.setFPS(MATRIX_FPS);
|
DisplayManager.setFPS(MATRIX_FPS);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
break;
|
||||||
else if (currentState == ColorMenu)
|
case ColorMenu:
|
||||||
{
|
|
||||||
TEXTCOLOR_565 = textColors[currentColor];
|
TEXTCOLOR_565 = textColors[currentColor];
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
break;
|
||||||
else if (currentState == MainMenu)
|
case MainMenu:
|
||||||
{
|
|
||||||
inMenu = false;
|
inMenu = false;
|
||||||
}
|
break;
|
||||||
else if (currentState == SwitchMenu)
|
case SwitchMenu:
|
||||||
{
|
|
||||||
DisplayManager.setAutoTransition(AUTO_TRANSITION);
|
DisplayManager.setAutoTransition(AUTO_TRANSITION);
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
break;
|
||||||
else if (currentState == TspeedMenu)
|
case TspeedMenu:
|
||||||
{
|
case AppTimeMenu:
|
||||||
DisplayManager.applyAllSettings();
|
DisplayManager.applyAllSettings();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
break;
|
||||||
else if (currentState == AppTimeMenu)
|
case TimeFormatMenu:
|
||||||
{
|
|
||||||
DisplayManager.applyAllSettings();
|
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
else if (currentState == TimeFormatMenu)
|
|
||||||
{
|
|
||||||
TIME_FORMAT = timeFormat[timeFormatIndex];
|
TIME_FORMAT = timeFormat[timeFormatIndex];
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
break;
|
||||||
else if (currentState == DateFormatMenu)
|
case DateFormatMenu:
|
||||||
{
|
case WeekdayMenu:
|
||||||
DATE_FORMAT = dateFormat[dateFormatIndex];
|
case TempMenu:
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
break;
|
||||||
else if (currentState == WeekdayMenu)
|
case Appmenu:
|
||||||
{
|
DisplayManager.loadNativeApps();
|
||||||
saveSettings();
|
|
||||||
}
|
|
||||||
else if (currentState == TempMenu)
|
|
||||||
{
|
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
currentState = MainMenu;
|
currentState = MainMenu;
|
||||||
}
|
}
|
||||||
@@ -432,4 +418,4 @@ void MenuManager_::selectButtonLong()
|
|||||||
{
|
{
|
||||||
inMenu = true;
|
inMenu = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,8 +84,6 @@ void ServerManager_::setup()
|
|||||||
mws.addOption("Prefix", MQTT_PREFIX);
|
mws.addOption("Prefix", MQTT_PREFIX);
|
||||||
mws.addOption("Homeassistant Discovery", HA_DISCOVERY);
|
mws.addOption("Homeassistant Discovery", HA_DISCOVERY);
|
||||||
mws.addOptionBox("Time");
|
mws.addOptionBox("Time");
|
||||||
mws.addOption("Show seconds", SHOW_SECONDS);
|
|
||||||
mws.addOption("Show weekday", SHOW_WEEKDAY);
|
|
||||||
mws.addOption("NTP Server", NTP_SERVER);
|
mws.addOption("NTP Server", NTP_SERVER);
|
||||||
mws.addOption("Timezone", NTP_TZ);
|
mws.addOption("Timezone", NTP_TZ);
|
||||||
mws.addHTML("<p>Find your timezone at <a href='https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv' target='_blank' rel='noopener noreferrer'>posix_tz_db</a>.</p>", "tz_link");
|
mws.addHTML("<p>Find your timezone at <a href='https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv' target='_blank' rel='noopener noreferrer'>posix_tz_db</a>.</p>", "tz_link");
|
||||||
@@ -95,10 +93,6 @@ void ServerManager_::setup()
|
|||||||
mws.addJavascript(custom_script);
|
mws.addJavascript(custom_script);
|
||||||
mws.addOptionBox("General");
|
mws.addOptionBox("General");
|
||||||
mws.addOption("Uppercase letters", UPPERCASE_LETTERS);
|
mws.addOption("Uppercase letters", UPPERCASE_LETTERS);
|
||||||
mws.addOption("Show date", SHOW_DATE);
|
|
||||||
mws.addOption("Show temperature", SHOW_TEMP);
|
|
||||||
mws.addOption("Show humidity", SHOW_HUM);
|
|
||||||
mws.addOption("Show battery", SHOW_BATTERY);
|
|
||||||
mws.addHandler("/save", HTTP_GET, saveHandler);
|
mws.addHandler("/save", HTTP_GET, saveHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,12 +193,6 @@ void ServerManager_::loadSettings()
|
|||||||
NET_PDNS = doc["Primary DNS"].as<String>();
|
NET_PDNS = doc["Primary DNS"].as<String>();
|
||||||
NET_SDNS = doc["Secondary DNS"].as<String>();
|
NET_SDNS = doc["Secondary DNS"].as<String>();
|
||||||
UPPERCASE_LETTERS = doc["Uppercase letters"];
|
UPPERCASE_LETTERS = doc["Uppercase letters"];
|
||||||
SHOW_SECONDS = doc["Show seconds"];
|
|
||||||
SHOW_WEEKDAY = doc["Show weekday"];
|
|
||||||
SHOW_DATE = doc["Show date"];
|
|
||||||
SHOW_TEMP = doc["Show temperature"];
|
|
||||||
SHOW_HUM = doc["Show humidity"];
|
|
||||||
SHOW_BATTERY = doc["Show battery"];
|
|
||||||
file.close();
|
file.close();
|
||||||
DisplayManager.applyAllSettings();
|
DisplayManager.applyAllSettings();
|
||||||
Serial.println(F("Configuration loaded"));
|
Serial.println(F("Configuration loaded"));
|
||||||
|
|||||||
2392
src/icons.cpp
Normal file
2392
src/icons.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2391
src/icons.h
2391
src/icons.h
File diff suppressed because it is too large
Load Diff
@@ -72,7 +72,7 @@ void setup()
|
|||||||
if (ServerManager.isConnected)
|
if (ServerManager.isConnected)
|
||||||
{
|
{
|
||||||
MQTTManager.setup();
|
MQTTManager.setup();
|
||||||
DisplayManager.loadApps();
|
DisplayManager.loadNativeApps();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user