Skip to content

Commit

Permalink
update weather example
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed Sep 4, 2023
1 parent 54ddea0 commit c8a4681
Show file tree
Hide file tree
Showing 5 changed files with 2,972 additions and 1,277 deletions.
23 changes: 17 additions & 6 deletions examples/weather/main/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@
#include "forecast_record.h"
#include "lang.h"

#define SCREEN_WIDTH EPD_WIDTH
#define SCREEN_HEIGHT EPD_HEIGHT
// choose the default demo board depending on the architecture
#ifdef CONFIG_IDF_TARGET_ESP32
#define DEMO_BOARD epd_board_v6
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#define DEMO_BOARD epd_board_v7
#endif

#define SCREEN_WIDTH (epd_width())
#define SCREEN_HEIGHT (epd_height())

// ################ VERSION ##################################################
String version = "1.0 / 9.7in"; // Programme version, see change log at end
Expand Down Expand Up @@ -322,12 +329,16 @@ void setup() {
}

void epd_task(void* pvParameters) {
epd_init(EPD_LUT_1K);
epd_init(&DEMO_BOARD, &ED097TC2, EPD_LUT_1K);
// Set VCOM for boards that allow to set this in software (in mV).
// This will print an error if unsupported. In this case,
// set VCOM using the hardware potentiometer and delete this line.
epd_set_vcom(1560);

ESP_LOGW("main", "allocating...\n");

fb = (uint8_t*)heap_caps_malloc(EPD_WIDTH * EPD_HEIGHT / 2, MALLOC_CAP_SPIRAM);
memset(fb, 0xFF, EPD_WIDTH * EPD_HEIGHT / 2);
fb = (uint8_t*)heap_caps_malloc(epd_width() * epd_height() / 2, MALLOC_CAP_SPIRAM);
memset(fb, 0xFF, epd_width() * epd_height() / 2);

while (1) {
loop();
Expand Down Expand Up @@ -512,7 +523,7 @@ bool decodeImage(WiFiClient& json) {
// convert it to a JsonObject
JsonArray array = doc.as<JsonArray>();
Serial.println("IMG Decoding ...");
uint8_t img_data[EPD_WIDTH * EPD_HEIGHT / 2];
uint8_t img_data[epd_width() * epd_height() / 2];
int i = 0;
for (JsonVariant v : array) {
img_data[i] = v.as<uint16_t>();
Expand Down
5 changes: 0 additions & 5 deletions examples/weather/partitions.csv

This file was deleted.

Loading

0 comments on commit c8a4681

Please sign in to comment.