8 Commits

Author SHA1 Message Date
Nic Limper
77cbf92281 bugfix getlocation 2023-08-13 01:48:32 +02:00
Moritz Wirger
c4022e45f9 Fix weather icons exception (#114) 2023-08-13 01:00:47 +02:00
atc1441
a13c220565 Fixed countdown via negative count value 2023-08-12 21:43:37 +02:00
Nic Limper
3989ecc3a3 bugfix date display 2023-08-12 21:17:08 +02:00
Nic Limper
cb0f029900 Update build-test.yml
don't build all small variations. Just the minor platforms, the rest will work.
2023-08-12 21:11:33 +02:00
Nic Limper
443714e9dc build fixes 2023-08-12 20:58:25 +02:00
Nic Limper
f3f163fa00 Revert "Ziped web files"
This reverts commit 8848cfc0f8.
2023-08-12 20:19:01 +02:00
Bot
8848cfc0f8 Ziped web files 2023-08-12 17:16:45 +00:00
11 changed files with 120 additions and 91 deletions

View File

@@ -32,11 +32,11 @@ jobs:
pio run --environment OpenEPaperLink_Mini_AP
pio run --target buildfs --environment OpenEPaperLink_Mini_AP
- name: Build OpenEPaperLink_Nano_AP
run: |
cd ESP32_AP-Flasher
pio run --environment OpenEPaperLink_Nano_AP
pio run --target buildfs --environment OpenEPaperLink_Nano_AP
# - name: Build OpenEPaperLink_Nano_AP
# run: |
# cd ESP32_AP-Flasher
# pio run --environment OpenEPaperLink_Nano_AP
# pio run --target buildfs --environment OpenEPaperLink_Nano_AP
- name: Build OpenEPaperLink_AP_and_Flasher
run: |
@@ -44,17 +44,17 @@ jobs:
pio run --environment OpenEPaperLink_AP_and_Flasher
pio run --target buildfs --environment OpenEPaperLink_AP_and_Flasher
- name: Build Wemos_d1_mini32_AP
run: |
cd ESP32_AP-Flasher
pio run --environment Wemos_d1_mini32_AP
pio run --target buildfs --environment Wemos_d1_mini32_AP
# - name: Build Wemos_d1_mini32_AP
# run: |
# cd ESP32_AP-Flasher
# pio run --environment Wemos_d1_mini32_AP
# pio run --target buildfs --environment Wemos_d1_mini32_AP
- name: Build M5Stack_Core_ONE_AP
run: |
cd ESP32_AP-Flasher
pio run --environment M5Stack_Core_ONE_AP
pio run --target buildfs --environment M5Stack_Core_ONE_AP
# - name: Build M5Stack_Core_ONE_AP
# run: |
# cd ESP32_AP-Flasher
# pio run --environment M5Stack_Core_ONE_AP
# pio run --target buildfs --environment M5Stack_Core_ONE_AP
- name: Build ESP32_S3_16_8_YELLOW_AP]
run: |
@@ -62,20 +62,20 @@ jobs:
pio run --environment ESP32_S3_16_8_YELLOW_AP
pio run --target buildfs --environment ESP32_S3_16_8_YELLOW_AP
- name: Build Sonoff_zb_bridge_P_AP
run: |
cd ESP32_AP-Flasher
pio run --environment Sonoff_zb_bridge_P_AP
pio run --target buildfs --environment Sonoff_zb_bridge_P_AP
# - name: Build Sonoff_zb_bridge_P_AP
# run: |
# cd ESP32_AP-Flasher
# pio run --environment Sonoff_zb_bridge_P_AP
# pio run --target buildfs --environment Sonoff_zb_bridge_P_AP
- name: Build OpenEPaperLink_CC1352P
run: |
cd ESP32_AP-Flasher
pio run --environment OpenEPaperLink_CC1352P
pio run --target buildfs --environment OpenEPaperLink_CC1352P
# - name: Build OpenEPaperLink_CC1352P
# run: |
# cd ESP32_AP-Flasher
# pio run --environment OpenEPaperLink_CC1352P
# pio run --target buildfs --environment OpenEPaperLink_CC1352P
- name: OutdoorAP
run: |
cd ESP32_AP-Flasher
pio run --environment OutdoorAP
pio run --target buildfs --environment OutdoorAP
# - name: OutdoorAP
# run: |
# cd ESP32_AP-Flasher
# pio run --environment OutdoorAP
# pio run --target buildfs --environment OutdoorAP

View File

@@ -21,17 +21,17 @@ jobs:
with:
python-version: '3.9'
- name: Zip web files
run: |
cd /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_AP-Flasher
python gzip_wwwfiles.py
# - name: Zip web files
# run: |
# cd /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_AP-Flasher
# python gzip_wwwfiles.py
- name: Commit zipped files
run: |
git config --global user.name 'Bot'
git config --global user.email "bot@openepaperlink.de"
git commit -am "Ziped web files"
git push origin HEAD:master
# - name: Commit zipped files
# run: |
# git config --global user.name 'Bot'
# git config --global user.email "bot@openepaperlink.de"
# git commit -am "Zipped web files"
# git push origin HEAD:master
- name: Install PlatformIO Core
run: pip install --upgrade platformio
@@ -150,6 +150,24 @@ jobs:
cd /home/runner/work/OpenEPaperLink/OpenEPaperLink
cp OpenEPaperLink_AP_and_Flasher/firmware.bin espbinaries/OpenEPaperLink_AP_and_Flasher.bin
cp OpenEPaperLink_AP_and_Flasher/merged-firmware.bin espbinaries/OpenEPaperLink_AP_and_Flasher_full.bin
- name: Build firmware for ESP32_S3_16_8_YELLOW_AP
run: |
cd ESP32_AP-Flasher
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref_name }} -D SHA=$GITHUB_SHA"
pio run --environment ESP32_S3_16_8_YELLOW_AP
pio run --target buildfs --environment ESP32_S3_16_8_YELLOW_AP
mkdir /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_S3_16_8_YELLOW_AP
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_S3_16_8_YELLOW_AP/boot_app0.bin
cp .pio/build/ESP32_S3_16_8_YELLOW_AP/firmware.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_S3_16_8_YELLOW_AP/firmware.bin
cp .pio/build/ESP32_S3_16_8_YELLOW_AP/bootloader.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_S3_16_8_YELLOW_AP/bootloader.bin
cp .pio/build/ESP32_S3_16_8_YELLOW_AP/partitions.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_S3_16_8_YELLOW_AP/partitions.bin
cp .pio/build/ESP32_S3_16_8_YELLOW_AP/littlefs.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_S3_16_8_YELLOW_AP/littlefs.bin
cd /home/runner/work/OpenEPaperLink/OpenEPaperLink/ESP32_S3_16_8_YELLOW_AP
esptool.py --chip esp32-s3 merge_bin -o merged-firmware.bin --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0000 bootloader.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 firmware.bin 0x00910000 littlefs.bin
cd /home/runner/work/OpenEPaperLink/OpenEPaperLink
cp ESP32_S3_16_8_YELLOW_AP/firmware.bin espbinaries/ESP32_S3_16_8_YELLOW_AP.bin
cp ESP32_S3_16_8_YELLOW_AP/merged-firmware.bin espbinaries/ESP32_S3_16_8_YELLOW_AP_full.bin
- name: generate release json file
run: |

Binary file not shown.

Binary file not shown.

View File

@@ -23,8 +23,8 @@ void drawString(TFT_eSprite &spr, String content, int16_t posx, int16_t posy, St
void initSprite(TFT_eSprite &spr, int w, int h, imgParam &imageParams);
void drawDate(String &filename, tagRecord *&taginfo, imgParam &imageParams);
void drawNumber(String &filename, int32_t count, int32_t thresholdred, tagRecord *&taginfo, imgParam &imageParams);
void drawWeather(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgParam &imageParams);
void drawForecast(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgParam &imageParams);
void drawWeather(String &filename, JsonObject &cfgobj, const tagRecord *taginfo, imgParam &imageParams);
void drawForecast(String &filename, JsonObject &cfgobj, const tagRecord *taginfo, imgParam &imageParams);
int getImgURL(String &filename, String URL, time_t fetched, imgParam &imageParams, String MAC);
bool getRssFeed(String &filename, String URL, String title, tagRecord *&taginfo, imgParam &imageParams);
bool getCalFeed(String &filename, String URL, String title, tagRecord *&taginfo, imgParam &imageParams);

View File

@@ -69,7 +69,7 @@ static void printLargestFreeBlock() {
/// @param timeout Request timeout
/// @param redirects Redirects handling
/// @return True on success, false on error (httpCode != 200 || deserialization error)
static bool httpGetJson(String &url, JsonDocument &json, const uint16_t timeout) //, const followRedirects_t redirects = followRedirects_t::HTTPC_DISABLE_FOLLOW_REDIRECTS)
static bool httpGetJson(String &url, JsonDocument &json, const uint16_t timeout, JsonDocument *filter = nullptr) //, const followRedirects_t redirects = followRedirects_t::HTTPC_DISABLE_FOLLOW_REDIRECTS)
{
HTTPClient http;
http.begin(url);
@@ -82,7 +82,12 @@ static bool httpGetJson(String &url, JsonDocument &json, const uint16_t timeout)
return false;
}
DeserializationError error = deserializeJson(json, http.getString());
DeserializationError error;
if (filter) {
error = deserializeJson(json, http.getString(), DeserializationOption::Filter(*filter));
} else {
error = deserializeJson(json, http.getString());
}
http.end();
if (error) {
Serial.println(error.c_str());

View File

@@ -533,7 +533,7 @@ void drawDate(String &filename, tagRecord *&taginfo, imgParam &imageParams) {
drawString(spr, String(timeinfo.tm_mday) + " " + languageMonth[getCurrentLanguage()][timeinfo.tm_mon], date[0], date[1], date[2], TC_DATUM);
} else {
const auto &month = loc["month"];
const auto &day = loc["month"];
const auto &day = loc["day"];
drawString(spr, languageDays[getCurrentLanguage()][timeinfo.tm_wday], weekday[0], weekday[1], weekday[2], TC_DATUM, TFT_BLACK);
drawString(spr, String(languageMonth[getCurrentLanguage()][timeinfo.tm_mon]), month[0], month[1], month[2], TC_DATUM);
drawString(spr, String(timeinfo.tm_mday), day[0], day[1], day[2], TC_DATUM, TFT_RED);
@@ -544,6 +544,8 @@ void drawDate(String &filename, tagRecord *&taginfo, imgParam &imageParams) {
}
void drawNumber(String &filename, int32_t count, int32_t thresholdred, tagRecord *&taginfo, imgParam &imageParams) {
int32_t countTemp = count;
count = abs(count);
if (taginfo->hwType == SOLUM_SEG_UK) {
imageParams.symbols = 0x00;
if (count > 19999) {
@@ -570,7 +572,7 @@ void drawNumber(String &filename, int32_t count, int32_t thresholdred, tagRecord
initSprite(spr, imageParams.width, imageParams.height, imageParams);
spr.setTextDatum(MC_DATUM);
if (count > thresholdred) {
if (countTemp > thresholdred) {
spr.setTextColor(TFT_RED, TFT_WHITE);
} else {
spr.setTextColor(TFT_BLACK, TFT_WHITE);
@@ -591,28 +593,28 @@ void drawNumber(String &filename, int32_t count, int32_t thresholdred, tagRecord
/// @param id Icon identifier/index
/// @param isNight Use night icons (true) or not (false)
/// @return String reference to icon
const String &getWeatherIcon(const uint8_t id, const bool isNight = false) {
static const String weatherIcons[] = {"\uf00d", "\uf00c", "\uf002", "\uf013", "\uf013", "\uf014", "", "", "\uf014", "", "",
"\uf01a", "", "\uf01a", "", "\uf01a", "\uf017", "\uf017", "", "", "",
"\uf019", "", "\uf019", "", "\uf019", "\uf015", "\uf015", "", "", "",
"\uf01b", "", "\uf01b", "", "\uf01b", "", "\uf076", "", "", "\uf01a",
"\uf01a", "\uf01a", "", "", "\uf064", "\uf064", "", "", "", "",
"", "", "", "", "\uf01e", "\uf01d", "", "", "\uf01e"};
const String getWeatherIcon(const uint8_t id, const bool isNight = false) {
const String weatherIcons[] = {"\uf00d", "\uf00c", "\uf002", "\uf013", "\uf013", "\uf014", "", "", "\uf014", "", "",
"\uf01a", "", "\uf01a", "", "\uf01a", "\uf017", "\uf017", "", "", "",
"\uf019", "", "\uf019", "", "\uf019", "\uf015", "\uf015", "", "", "",
"\uf01b", "", "\uf01b", "", "\uf01b", "", "\uf076", "", "", "\uf01a",
"\uf01a", "\uf01a", "", "", "\uf064", "\uf064", "", "", "", "",
"", "", "", "", "\uf01e", "\uf01d", "", "", "\uf01e"};
if (isNight && id <= 3) {
static const String nightIcons[] = {"\uf02e", "\uf083", "\uf086"};
const String nightIcons[] = {"\uf02e", "\uf083", "\uf086"};
return nightIcons[id];
}
return weatherIcons[id];
}
void drawWeather(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgParam &imageParams) {
void drawWeather(String &filename, JsonObject &cfgobj, const tagRecord *taginfo, imgParam &imageParams) {
wsLog("get weather");
getLocation(cfgobj);
String lat = cfgobj["#lat"];
String lon = cfgobj["#lon"];
String tz = cfgobj["#tz"];
const String lat = cfgobj["#lat"];
const String lon = cfgobj["#lon"];
const String tz = cfgobj["#tz"];
StaticJsonDocument<1000> doc;
const bool success = util::httpGetJson("https://api.open-meteo.com/v1/forecast?latitude=" + lat + "&longitude=" + lon + "&current_weather=true&windspeed_unit=ms&timezone=" + tz, doc, 5000);
@@ -624,7 +626,7 @@ void drawWeather(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgP
const double temperature = currentWeather["temperature"].as<double>();
const int windspeed = currentWeather["windspeed"].as<int>();
const int winddirection = currentWeather["winddirection"].as<int>();
const uint8_t isday = currentWeather["is_day"].as<int>();
const bool isNight = currentWeather["is_day"].as<int>() == 0;
uint8_t weathercode = currentWeather["weathercode"].as<int>();
if (weathercode > 40) weathercode -= 40;
const int beaufort = windSpeedToBeaufort(windspeed);
@@ -632,12 +634,12 @@ void drawWeather(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgP
doc.clear();
if (taginfo->hwType == SOLUM_SEG_UK) {
static const String weatherText[] = {"sun", "sun", "sun", "CLDY", "CLDY", "FOG", "", "", "FOG", "", "",
"DRZL", "", "DRZL", "", "DRZL", "ice", "ice", "", "", "",
"rain", "", "rain", "", "rain", "ice", "ice", "", "", "",
"SNOW", "", "SNOW", "", "SNOW", "", "SNOW", "", "", "rain",
"rain", "rain", "", "", "SNOW", "SNOW", "", "", "", "",
"", "", "", "", "STRM", "HAIL", "", "", "HAIL"};
const String weatherText[] = {"sun", "sun", "sun", "CLDY", "CLDY", "FOG", "", "", "FOG", "", "",
"DRZL", "", "DRZL", "", "DRZL", "ice", "ice", "", "", "",
"rain", "", "rain", "", "rain", "ice", "ice", "", "", "",
"SNOW", "", "SNOW", "", "SNOW", "", "SNOW", "", "", "rain",
"rain", "rain", "", "", "SNOW", "SNOW", "", "", "", "",
"", "", "", "", "STRM", "HAIL", "", "", "HAIL"};
if (temperature < -9.9) {
sprintf(imageParams.segments, "%3d^%2d%-4.4s", static_cast<int>(temperature), beaufort, weatherText[weathercode].c_str());
imageParams.symbols = 0x00;
@@ -668,7 +670,7 @@ void drawWeather(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgP
? TFT_RED
: TFT_BLACK;
const auto &icon = doc["icon"];
drawString(spr, getWeatherIcon(weathercode, isday == 0), icon[0], icon[1], "/fonts/weathericons.ttf", icon[3], iconcolor, icon[2]);
drawString(spr, getWeatherIcon(weathercode, isNight), icon[0], icon[1], "/fonts/weathericons.ttf", icon[3], iconcolor, icon[2]);
const auto &dir = doc["dir"];
drawString(spr, windDirectionIcon(winddirection), dir[0], dir[1], "/fonts/weathericons.ttf", TC_DATUM, TFT_BLACK, dir[2]);
if (weathercode > 10) {
@@ -680,9 +682,7 @@ void drawWeather(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgP
spr.deleteSprite();
}
void drawForecast(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgParam &imageParams) {
TFT_eSprite spr = TFT_eSprite(&tft);
void drawForecast(String &filename, JsonObject &cfgobj, const tagRecord *taginfo, imgParam &imageParams) {
wsLog("get weather");
getLocation(cfgobj);
@@ -696,6 +696,7 @@ void drawForecast(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, img
return;
}
TFT_eSprite spr = TFT_eSprite(&tft);
tft.setTextWrap(false, false);
StaticJsonDocument<512> loc;
@@ -1197,8 +1198,12 @@ void getLocation(JsonObject &cfgobj) {
if (util::isEmptyOrNull(lat) || util::isEmptyOrNull(lon)) {
wsLog("get location");
StaticJsonDocument<80> filter;
filter["results"][0]["latitude"] = true;
filter["results"][0]["longitude"] = true;
filter["results"][0]["timezone"] = true;
StaticJsonDocument<1000> doc;
if (util::httpGetJson("https://geocoding-api.open-meteo.com/v1/search?name=" + urlEncode(cfgobj["location"]) + "&count=1", doc, 5000)) {
if (util::httpGetJson("https://geocoding-api.open-meteo.com/v1/search?name=" + urlEncode(cfgobj["location"]) + "&count=1", doc, 5000, &filter)) {
cfgobj["#lat"] = doc["results"][0]["latitude"].as<String>();
cfgobj["#lon"] = doc["results"][0]["longitude"].as<String>();
cfgobj["#tz"] = doc["results"][0]["timezone"].as<String>();

View File

@@ -165,34 +165,34 @@ void spr2color(TFT_eSprite &spr, imgParam &imageParams, uint8_t *buffer, size_t
color.b + error_bufferold[x].b - palette[best_color_index].b};
// Burkes Dithering
error_buffernew[x].r += error.r / 4.0f;
error_buffernew[x].g += error.g / 4.0f;
error_buffernew[x].b += error.b / 4.0f;
error_buffernew[x].r += error.r >> 2;
error_buffernew[x].g += error.g >> 2;
error_buffernew[x].b += error.b >> 2;
if (x > 0) {
error_buffernew[x - 1].r += error.r / 8.0f;
error_buffernew[x - 1].g += error.g / 8.0f;
error_buffernew[x - 1].b += error.b / 8.0f;
error_buffernew[x - 1].r += error.r >> 3;
error_buffernew[x - 1].g += error.g >> 3;
error_buffernew[x - 1].b += error.b >> 3;
}
if (x > 1) {
error_buffernew[x - 2].r += error.r / 16.0f;
error_buffernew[x - 2].g += error.g / 16.0f;
error_buffernew[x - 2].b += error.b / 16.0f;
error_buffernew[x - 2].r += error.r >> 4;
error_buffernew[x - 2].g += error.g >> 4;
error_buffernew[x - 2].b += error.b >> 4;
}
error_buffernew[x + 1].r += error.r / 8.0f;
error_buffernew[x + 1].g += error.g / 8.0f;
error_buffernew[x + 1].b += error.b / 8.0f;
error_buffernew[x + 1].r += error.r >> 3;
error_buffernew[x + 1].g += error.g >> 3;
error_buffernew[x + 1].b += error.b >> 3;
error_bufferold[x + 1].r += error.r / 4.0f;
error_bufferold[x + 1].g += error.g / 4.0f;
error_bufferold[x + 1].b += error.b / 4.0f;
error_bufferold[x + 1].r += error.r >> 2;
error_bufferold[x + 1].g += error.g >> 2;
error_bufferold[x + 1].b += error.b >> 2;
error_buffernew[x + 2].r += error.r / 16.0f;
error_buffernew[x + 2].g += error.g / 16.0f;
error_buffernew[x + 2].b += error.b / 16.0f;
error_buffernew[x + 2].r += error.r >> 4;
error_buffernew[x + 2].g += error.g >> 4;
error_buffernew[x + 2].b += error.b >> 4;
error_bufferold[x + 2].r += error.r / 8.0f;
error_bufferold[x + 2].g += error.g / 8.0f;
error_bufferold[x + 2].b += error.b / 8.0f;
error_bufferold[x + 2].r += error.r >> 3;
error_bufferold[x + 2].g += error.g >> 3;
error_bufferold[x + 2].b += error.b >> 3;
}
}
memcpy(error_bufferold, error_buffernew, bufw * sizeof(Error));

View File

@@ -56,6 +56,7 @@ tagota = generate_file_hashes2(rp + "/binaries",tag)
files1 = generate_file_hashes(rp + "/ESP32_AP-Flasher/data/www","/www/",tag)
files1.extend(generate_file_hashes(rp + "/ESP32_AP-Flasher/data","/",tag))
files1.extend(generate_file_hashes(rp + "/ESP32_AP-Flasher/data/fonts","/fonts/",tag))
files1.extend(generate_file_hashes(rp + "/ESP32_AP-Flasher/data/tagtypes","/tagtypes/",tag))
jsonarray = {
"releaseid": tag,