Working row settings, build all targets

This commit is contained in:
Djuri Baars 2024-03-17 00:47:59 +01:00
parent c5c7791c33
commit 626877d4ee
4 changed files with 128 additions and 76 deletions

View file

@ -28,6 +28,7 @@ jobs:
build: build:
needs: prepare needs: prepare
continue-on-error: true
strategy: strategy:
matrix: matrix:
epd_variant: [213epd, 29epd] epd_variant: [213epd, 29epd]

View file

@ -10,7 +10,7 @@
[platformio] [platformio]
data_dir = data/build data_dir = data/build
default_envs = lolin_s2_mini_213epd, lolin_s2_mini_29epd, lolin_s3_mini_213epd default_envs = lolin_s2_mini_213epd, lolin_s2_mini_29epd, lolin_s3_mini_213epd, lolin_s3_mini_29epd
[btclock_base] [btclock_base]
platform = espressif32 platform = espressif32

View file

@ -21,6 +21,10 @@ GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(4, 2, 3, 1);
GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(5, 3, 2, 1); GxEPD2_BW<EPD_CLASS, EPD_CLASS::HEIGHT> display = EPD_CLASS(5, 3, 2, 1);
#endif #endif
typedef void (*MethodPtr)(String);
MethodPtr methods[] = { nullptr, updateRow1, updateRow2, updateRow3 };
WiFiClientSecure client; WiFiClientSecure client;
uint currentPrice = 0; uint currentPrice = 0;
String currentBlock = ""; String currentBlock = "";
@ -89,93 +93,139 @@ void loop()
} }
} }
String block = String(getBlock());
uint tryCount = 0;
while (block.equals(""))
{
block = getBlock();
Serial.print("Retry block..");
tryCount++;
Serial.println(tryCount); for (uint i = 1; i <= 3; i++) {
delay(1000); String rowContent = "";
char keyName[5];
if (tryCount % 5) snprintf(keyName, sizeof(keyName), "row%d", i);
{ Serial.print(keyName);
WiFi.disconnect(); Serial.print(" ");
WiFi.reconnect(); Serial.println(preferences.getUInt(keyName));
switch (preferences.getUInt(keyName)) {
while (WiFi.status() != WL_CONNECTED) case LINE_BLOCKHEIGHT:
{ rowContent = getBlock();
Serial.print('.'); break;
delay(1000); case LINE_MEMPOOL_FEES:
rowContent = getMempoolFees();
break;
case LINE_MEMPOOL_FEES_MEDIAN:
rowContent = "NOT IMPL";
break;
case LINE_HALVING_COUNTDOWN:
rowContent = "NOT IMPL";
break;
case LINE_SATSPERUNIT: {
uint satsPerDollar = int(round(1 / float(getPrice()) * 10e7));
rowContent = satsPerDollar;
break;
} }
case LINE_FIATPRICE:
rowContent = getPrice();
break;
case LINE_MARKETCAP:
rowContent = "NOT IMPL";
break;
case LINE_TIME:
rowContent = "NOT IMPL";
break;
case LINE_DATE:
rowContent = "NOT IMPL";
break;
default:
rowContent = "DEFAULT";
} }
methods[i](rowContent);
} }
uint price = getPrice(); // String block = String(getBlock());
tryCount = 0;
while (price == 0)
{
price = getPrice();
if (Serial.available())
Serial.print("Retry price..");
tryCount++;
if (Serial.available())
Serial.println(tryCount);
delay(1000);
}
uint satsPerDollar = int(round(1 / float(price) * 10e7)); // uint tryCount = 0;
// while (block.equals(""))
// {
// block = getBlock();
// Serial.print("Retry block..");
// tryCount++;
String mempoolFees = getMempoolFees(); // Serial.println(tryCount);
tryCount = 0; // delay(1000);
while (mempoolFees.equals(""))
{
mempoolFees = getMempoolFees();
Serial.print("Retry mempoolfees..");
tryCount++;
Serial.println(tryCount); // if (tryCount % 5)
delay(1000); // {
} // WiFi.disconnect();
// WiFi.reconnect();
if (!currentFees.equals(mempoolFees)) // while (WiFi.status() != WL_CONNECTED)
{ // {
updateRow1(mempoolFees); // Serial.print('.');
currentFees = mempoolFees; // delay(1000);
Serial.print(F("Fees is now ")); // }
Serial.println(currentFees); // }
} // }
else
{
Serial.println(F("No need to update fees"));
}
if (price != currentPrice) // uint price = getPrice();
{ // tryCount = 0;
updateRow3(String(satsPerDollar)); // while (price == 0)
currentPrice = price; // {
Serial.print(F("Price is now ")); // price = getPrice();
Serial.println(currentPrice); // if (Serial.available())
} // Serial.print("Retry price..");
else // tryCount++;
{ // if (Serial.available())
Serial.println(F("No need to update price")); // Serial.println(tryCount);
} // delay(1000);
// }
if (!block.equals(currentBlock)) // uint satsPerDollar = int(round(1 / float(price) * 10e7));
{
updateRow2(block); // String mempoolFees = getMempoolFees();
currentBlock = block; // tryCount = 0;
Serial.print(F("Block is now ")); // while (mempoolFees.equals(""))
Serial.println(currentBlock); // {
} // mempoolFees = getMempoolFees();
else // Serial.print("Retry mempoolfees..");
{ // tryCount++;
Serial.println(F("No need to update block"));
} // Serial.println(tryCount);
// delay(1000);
// }
// if (!currentFees.equals(mempoolFees))
// {
// updateRow1(mempoolFees);
// currentFees = mempoolFees;
// Serial.print(F("Fees is now "));
// Serial.println(currentFees);
// }
// else
// {
// Serial.println(F("No need to update fees"));
// }
// if (price != currentPrice)
// {
// updateRow3(String(satsPerDollar));
// currentPrice = price;
// Serial.print(F("Price is now "));
// Serial.println(currentPrice);
// }
// else
// {
// Serial.println(F("No need to update price"));
// }
// if (!block.equals(currentBlock))
// {
// updateRow2(block);
// currentBlock = block;
// Serial.print(F("Block is now "));
// Serial.println(currentBlock);
// }
// else
// {
// Serial.println(F("No need to update block"));
// }
// updateRows(mempoolFees, block, String(price)); // updateRows(mempoolFees, block, String(price));

View file

@ -21,6 +21,7 @@ void setupWebserver()
server.serveStatic("/build", LittleFS, "/build"); server.serveStatic("/build", LittleFS, "/build");
server.on("/", HTTP_GET, onIndex); server.on("/", HTTP_GET, onIndex);
server.onNotFound(onNotFound);
DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*"); DefaultHeaders::Instance().addHeader("Access-Control-Allow-Origin", "*");
DefaultHeaders::Instance().addHeader("Access-Control-Allow-Methods", DefaultHeaders::Instance().addHeader("Access-Control-Allow-Methods",