Skip to content

Commit

Permalink
Slightly reduce json buffer size on boards with PSRAM
Browse files Browse the repository at this point in the history
Found out that the main JSON 'doc' is still living in normal RAM, even when PSRAM is available... 
This results is very low RAM especially on -S2.

This change tries to find a balance between "need large json buffer" and "other features become unstable when free RAM is low".
  • Loading branch information
softhack007 authored Dec 11, 2023
1 parent d2c9c9e commit d63b716
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wled00/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,12 @@
#if defined(BOARD_HAS_PSRAM) && (defined(WLED_USE_PSRAM) || defined(WLED_USE_PSRAM_JSON))
#if defined(ARDUINO_ARCH_ESP32S2) || defined(ARDUINO_ARCH_ESP32C3)
#if defined(ARDUINO_ARCH_ESP32C3)
#define JSON_BUFFER_SIZE 46000 // WLEDMM - max 46KB on -C3 with PSRAM (chip has 400kb RAM)
#define JSON_BUFFER_SIZE 44000 // WLEDMM - max 44KB on -C3 with PSRAM (chip has 400kb RAM)
#else
#define JSON_BUFFER_SIZE 36000 // WLEDMM - max 36KB on -S2 with PSRAM (chip has 320kb RAM)
#define JSON_BUFFER_SIZE 32000 // WLEDMM - max 32KB on -S2 with PSRAM (chip has 320kb RAM)
#endif
#else
#define JSON_BUFFER_SIZE 56000 // WLEDMM (was 60000) slightly reduced to avoid build error "region dram0_0_seg overflowed"
#define JSON_BUFFER_SIZE 54000 // WLEDMM (was 60000) slightly reduced to avoid build error "region dram0_0_seg overflowed"
#endif
#else
#define JSON_BUFFER_SIZE 24576
Expand Down

0 comments on commit d63b716

Please sign in to comment.