Skip to content

Commit

Permalink
Merge branch 's3_lcd' into s3_color_implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Sep 29, 2023
2 parents dfa5660 + fdc3015 commit b9b6383
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 48 deletions.
6 changes: 3 additions & 3 deletions examples/mpd_status/dependencies.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
component_hash: null
source:
type: idf
version: 5.0.0
manifest_hash: 9d4dcd3c8f27cde5e52f2fba13d202ee2deaa3855572295835aeeb508b8b2c24
target: esp32
version: 5.1.1
manifest_hash: 21c5347826a179bf9c93a91c1012b3240455cc051b9fd4ac05364a0a2dedac7f
target: esp32s3
version: 1.0.0
6 changes: 4 additions & 2 deletions examples/mpd_status/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const int album_cover_y = 100;
const int queue_x_end = 1500;
const int queue_y_start = 100;

#define MPD_IP "192.168.69.90"

EpdiyHighlevelState hl;

static bool got_ip = false;
Expand Down Expand Up @@ -110,7 +112,7 @@ void handle_error(struct mpd_connection** c) {
}

void epd_task() {
epd_init(&DEMO_BOARD, &ED097TC2, EPD_LUT_1K);
epd_init(&DEMO_BOARD, &ED097TC2, EPD_OPTIONS_DEFAULT);
// 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.
Expand Down Expand Up @@ -179,7 +181,7 @@ void epd_task() {
while (true) {
// connect / reconnect
if (mpd_conn == NULL) {
mpd_conn = mpd_connection_new("192.168.42.50", 6600, 3000);
mpd_conn = mpd_connection_new(MPD_IP, 6600, 3000);
handle_error(&mpd_conn);
int i;
printf("mpd server version: ");
Expand Down
5 changes: 5 additions & 0 deletions examples/mpd_status/partitions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1950K,
6 changes: 3 additions & 3 deletions examples/mpd_status/sdkconfig.defaults.esp32
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
# Partition Table
#
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
# CONFIG_PARTITION_TABLE_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table
Expand Down
6 changes: 3 additions & 3 deletions examples/mpd_status/sdkconfig.defaults.esp32s3
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
# Partition Table
#
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
# CONFIG_PARTITION_TABLE_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table
Expand Down
1 change: 0 additions & 1 deletion examples/terminal/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "freertos/task.h"

#include "epdiy.h"
#include "soc/clk_tree_defs.h"
#include "st.h"

// choose the default demo board depending on the architecture
Expand Down
4 changes: 1 addition & 3 deletions examples/terminal/main/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -2767,8 +2767,7 @@ static void draw_mask(EpdRect area, uint8_t* mask, bool* dirtyness) {
enum EpdDrawMode mode = MODE_PACKING_8PPB | MODE_EPDIY_MONOCHROME | PREVIOUSLY_WHITE;

enum EpdDrawError err = epd_draw_base(
epd_full_screen(), mask, area, mode,
temperature, dirtyness, EPD_BUILTIN_WAVEFORM
epd_full_screen(), mask, area, mode, temperature, dirtyness, EPD_BUILTIN_WAVEFORM
);
if (err != EPD_DRAW_SUCCESS) {
die("EPD draw error: %X\n", err);
Expand Down Expand Up @@ -2853,7 +2852,6 @@ void epd_render(void) {
term.dirty[y] = 0;
}


// wait for rendering completion
for (int li = 0; li < drawn_lines; li++) {
xSemaphoreTake(render_lines_done_smphr, portMAX_DELAY);
Expand Down
2 changes: 2 additions & 0 deletions examples/weather/main/main.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// weather.cpp is the actual main file,
// this is just for Arduino to recognize this as a project.
67 changes: 37 additions & 30 deletions examples/weather/main/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ boolean SetupTime() {
); //(gmtOffset_sec, daylightOffset_sec, ntpServer)
setenv("TZ", Timezone, 1); // setenv()adds the "TZ" variable to the environment with a value
// TimeZone, only used if set to 1, 0 means no change
tzset(); // Set the TZ environment variable
tzset(); // Set the TZ environment variable
delay(100);
bool TimeStatus = UpdateLocalTime();
return TimeStatus;
Expand Down Expand Up @@ -276,8 +276,30 @@ void loop() {
}

void setup() {

ESP_LOGW("main", "Hello World!\n");

heap_caps_print_heap_info(MALLOC_CAP_INTERNAL);
heap_caps_print_heap_info(MALLOC_CAP_SPIRAM);

epd_init(&DEMO_BOARD, &ED097TC2, EPD_LUT_64K);
// 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);

EpdiyHighlevelState hl;

hl = epd_hl_init(EPD_BUILTIN_WAVEFORM);

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

fb = epd_hl_get_framebuffer(&hl);

StartTime = millis();

Serial.begin(115200);

if (StartWiFi() == WL_CONNECTED && SetupTime() == true) {
// if ((CurrentHour >= WakeupTime && CurrentHour <= SleepTime)) {
byte Attempts = 1;
Expand Down Expand Up @@ -307,57 +329,42 @@ void setup() {
// drawImage(client);
DisplayWeather();
// DisplayTime();
//
printf("Buffer is prepared.\n");

t1 = Millis();
int temperature = epd_ambient_temperature();
if (temperature <= 0)
temperature = 25;
enum EpdDrawMode mode =
(enum EpdDrawMode)(MODE_GC16 | MODE_PACKING_2PPB | PREVIOUSLY_WHITE);
epd_draw_base(
epd_full_screen(), fb, epd_full_screen(), mode, temperature, NULL,
EPD_BUILTIN_WAVEFORM
);

enum EpdDrawError err = epd_hl_update_screen(&hl, MODE_GC16, temperature);
t2 = Millis();
epd_poweroff();

if (err != EPD_DRAW_SUCCESS) {
printf("EPD Draw error %X!\n", err);
}

// display.display(false); // Full screen update mode
}
//}
}
BeginSleep();
}

void epd_task(void* pvParameters) {
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);

while (1) {
loop();
};
}

#ifndef ARDUINO
extern "C" {
void app_main() {
ESP_LOGW("main", "Hello World!\n");

heap_caps_print_heap_info(MALLOC_CAP_INTERNAL);
heap_caps_print_heap_info(MALLOC_CAP_SPIRAM);

xTaskCreatePinnedToCore(&epd_task, "epd task", 10000, NULL, 2, NULL, 1);

initArduino();
setup();

while (1) {
loop();
};
}
}
#endif

void drawImage(WiFiClient& client) {
getRandomImage(client);
Expand Down
2 changes: 1 addition & 1 deletion examples/www-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Do not forget to update your WiFi credentials and point it to a proper URL that
#define ESP_WIFI_SSID "WIFI NAME"
#define ESP_WIFI_PASSWORD ""
// www URL of the JPG image. As default:
#define IMG_URL ("https://loremflickr.com/"STR(EPD_WIDTH)"/"STR(EPD_HEIGHT))
#define IMG_URL ("https://loremflickr.com/800/600")
```
Progressive JPG images are not supported.
Expand Down
2 changes: 1 addition & 1 deletion examples/www-image/main/jpgdec-render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void wifi_init_sta(void) {
void app_main() {
enum EpdInitOptions init_options = EPD_LUT_64K;

epd_init(&epd_board_v7, &GDEW101C01, EPD_LUT_64K);
epd_init(&epd_board_v7, &GDEW101C01, init_options);
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/displays.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const EpdDisplay_t GDEW101C01 = {
.width = 2232,
.height = 1680,
.bus_width = 16,
.bus_speed = 8,
.bus_speed = 10,
.default_waveform = &epdiy_GDEW101C01,
.display_type = DISPLAY_TYPE_GENERIC,
};
5 changes: 5 additions & 0 deletions src/epdiy.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ typedef struct {
enum EpdFontFlags flags;
} EpdFontProperties;

#include "epd_board.h"
#include "epd_display.h"
#include "epd_highlevel.h"
#include "epd_board_specific.h"

/** Initialize the ePaper display */
void epd_init(const EpdBoardDefinition* board, const EpdDisplay_t* display, enum EpdInitOptions options);

Expand Down

0 comments on commit b9b6383

Please sign in to comment.