Add Mow mode notation and setting
Some checks failed
BTClock CI / build (push) Failing after 30s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Has been skipped
BTClock CI / release (push) Has been skipped
Some checks failed
BTClock CI / build (push) Failing after 30s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Has been skipped
BTClock CI / release (push) Has been skipped
This commit is contained in:
parent
239297c26d
commit
d37307cccf
10 changed files with 124 additions and 15 deletions
|
@ -18,6 +18,8 @@
|
|||
#define DEFAULT_DISABLE_FL false
|
||||
#define DEFAULT_OWN_DATA_SOURCE true
|
||||
#define DEFAULT_STAGING_SOURCE false
|
||||
#define DEFAULT_MOW_MODE false
|
||||
|
||||
#define DEFAULT_V2_SOURCE_CURRENCY CURRENCY_USD
|
||||
|
||||
|
||||
|
|
|
@ -283,7 +283,10 @@ void prepareDisplayUpdateTask(void *pvParameters)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (epdContent[epdIndex].length() > 1 && epdContent[epdIndex].indexOf(".") == -1)
|
||||
if (epdContent[epdIndex].length() == 2) {
|
||||
showChars(epdIndex, epdContent[epdIndex], updatePartial, &FONT_BIG);
|
||||
}
|
||||
else if (epdContent[epdIndex].length() > 1 && epdContent[epdIndex].indexOf(".") == -1)
|
||||
{
|
||||
if (epdContent[epdIndex].equals("STS"))
|
||||
{
|
||||
|
@ -407,6 +410,32 @@ void splitText(const uint dispNum, const String &top, const String &bottom,
|
|||
displays[dispNum].print(bottom);
|
||||
}
|
||||
|
||||
// void showChars(const uint dispNum, const String &chars, bool partial,
|
||||
// const GFXfont *font)
|
||||
// {
|
||||
// displays[dispNum].setRotation(2);
|
||||
// displays[dispNum].setFont(font);
|
||||
// displays[dispNum].setTextColor(getFgColor());
|
||||
// int16_t tbx, tby;
|
||||
// uint16_t tbw, tbh;
|
||||
|
||||
// displays[dispNum].getTextBounds(chars, 0, 0, &tbx, &tby, &tbw, &tbh);
|
||||
|
||||
// // center the bounding box by transposition of the origin:
|
||||
// uint16_t x = ((displays[dispNum].width() - tbw) / 2) - tbx;
|
||||
// uint16_t y = ((displays[dispNum].height() - tbh) / 2) - tby;
|
||||
|
||||
// displays[dispNum].fillScreen(getBgColor());
|
||||
|
||||
// displays[dispNum].setCursor(x, y);
|
||||
// displays[dispNum].print(chars);
|
||||
|
||||
// // displays[dispNum].setCursor(10, 3);
|
||||
// // displays[dispNum].setFont(&FONT_SMALL);
|
||||
// // displays[dispNum].setTextColor(getFgColor());
|
||||
// // displays[dispNum].println("Y = " + y);
|
||||
// }
|
||||
|
||||
void showDigit(const uint dispNum, char chr, bool partial,
|
||||
const GFXfont *font)
|
||||
{
|
||||
|
@ -466,6 +495,18 @@ void showDigit(const uint dispNum, char chr, bool partial,
|
|||
// displays[dispNum].println("Y = " + y);
|
||||
}
|
||||
|
||||
int16_t calculateDescent(const GFXfont *font) {
|
||||
int16_t maxDescent = 0;
|
||||
for (uint16_t i = font->first; i <= font->last; i++) {
|
||||
GFXglyph *glyph = &font->glyph[i - font->first];
|
||||
int16_t descent = glyph->yOffset;
|
||||
if (descent > maxDescent) {
|
||||
maxDescent = descent;
|
||||
}
|
||||
}
|
||||
return maxDescent;
|
||||
}
|
||||
|
||||
void showChars(const uint dispNum, const String &chars, bool partial,
|
||||
const GFXfont *font)
|
||||
{
|
||||
|
@ -475,12 +516,35 @@ void showChars(const uint dispNum, const String &chars, bool partial,
|
|||
int16_t tbx, tby;
|
||||
uint16_t tbw, tbh;
|
||||
displays[dispNum].getTextBounds(chars, 0, 0, &tbx, &tby, &tbw, &tbh);
|
||||
|
||||
int16_t descent = calculateDescent(font);
|
||||
|
||||
// center the bounding box by transposition of the origin:
|
||||
uint16_t x = ((displays[dispNum].width() - tbw) / 2) - tbx;
|
||||
uint16_t y = ((displays[dispNum].height() - tbh) / 2) - tby;
|
||||
displays[dispNum].fillScreen(getBgColor());
|
||||
displays[dispNum].setCursor(x, y);
|
||||
displays[dispNum].print(chars);
|
||||
// displays[dispNum].setCursor(x, y);
|
||||
// displays[dispNum].print(chars);
|
||||
|
||||
for (int i = 0; i < chars.length(); i++) {
|
||||
char c = chars[i];
|
||||
if (c == '.' || c == ',') {
|
||||
// For the dot, calculate its specific descent
|
||||
GFXglyph *dotGlyph = &font->glyph[c -font->first];
|
||||
int16_t dotDescent = dotGlyph->yOffset;
|
||||
|
||||
// Draw the dot with adjusted y-position
|
||||
displays[dispNum].setCursor(x, y + dotDescent + dotGlyph->height);
|
||||
displays[dispNum].print(c);
|
||||
} else {
|
||||
// For other characters, use the original y-position
|
||||
displays[dispNum].setCursor(x, y);
|
||||
displays[dispNum].print(c);
|
||||
}
|
||||
|
||||
// Move x-position for the next character
|
||||
x += font->glyph[c - font->first].xAdvance;
|
||||
}
|
||||
}
|
||||
|
||||
int getBgColor() { return bgColor; }
|
||||
|
|
|
@ -41,7 +41,7 @@ void workerTask(void *pvParameters) {
|
|||
uint price = getPrice(currency);
|
||||
|
||||
if (getCurrentScreen() == SCREEN_BTC_TICKER) {
|
||||
taskEpdContent = parsePriceData(price, currency, preferences.getBool("suffixPrice", DEFAULT_SUFFIX_PRICE));
|
||||
taskEpdContent = parsePriceData(price, currency, preferences.getBool("suffixPrice", DEFAULT_SUFFIX_PRICE), preferences.getBool("mowMode", DEFAULT_MOW_MODE));
|
||||
} else if (getCurrentScreen() == SCREEN_SATS_PER_CURRENCY) {
|
||||
taskEpdContent = parseSatsPerCurrency(price, currency, preferences.getBool("useSatsSymbol", DEFAULT_USE_SATS_SYMBOL));
|
||||
} else {
|
||||
|
|
|
@ -546,6 +546,7 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json)
|
|||
"mdnsEnabled", "otaEnabled", "stealFocus",
|
||||
"mcapBigChar", "useSatsSymbol", "useBlkCountdown",
|
||||
"suffixPrice", "disableLeds", "ownDataSource",
|
||||
"mowMode",
|
||||
"flAlwaysOn", "flDisable", "flFlashOnUpd",
|
||||
"mempoolSecure", "useNostr", "bitaxeEnabled",
|
||||
"nostrZapNotify", "stagingSource", "httpAuthEnabled"};
|
||||
|
@ -687,6 +688,7 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
|
|||
root["useBlkCountdown"] = preferences.getBool("useBlkCountdown", DEFAULT_USE_BLOCK_COUNTDOWN);
|
||||
root["suffixPrice"] = preferences.getBool("suffixPrice", DEFAULT_SUFFIX_PRICE);
|
||||
root["disableLeds"] = preferences.getBool("disableLeds", DEFAULT_DISABLE_LEDS);
|
||||
root["mowMode"] = preferences.getBool("mowMode", DEFAULT_MOW_MODE);
|
||||
|
||||
root["hostnamePrefix"] = preferences.getString("hostnamePrefix", DEFAULT_HOSTNAME_PREFIX);
|
||||
root["hostname"] = getMyHostname();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue