Skip to content

Commit 813b848

Browse files
committed
Remove PSRAM configuration
1 parent 6aa23cf commit 813b848

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

src/SnapClient.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ class SnapClient {
110110

111111
setupMDNS();
112112

113-
setupPSRAM();
114-
115113
#if CONFIG_SNAPCLIENT_SNTP_ENABLE
116114
SnapTime::instance().setupSNTPTime();
117115
#endif
@@ -208,16 +206,6 @@ class SnapClient {
208206
#endif
209207
}
210208

211-
void setupPSRAM() {
212-
#if CONFIG_USE_PSRAM && defined(ESP32)
213-
if (ESP.getPsramSize() > 0) {
214-
heap_caps_malloc_extmem_enable(CONFIG_PSRAM_LIMIT);
215-
ESP_LOGD(TAG, "PSRAM for allocations > %d bytes", CONFIG_PSRAM_LIMIT);
216-
} else {
217-
ESP_LOGW(TAG, "No PSRAM available or PSRAM not activated");
218-
}
219-
#endif
220-
}
221209

222210
void setupMACAddress() {
223211
#ifdef ESP32

src/SnapConfig.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
// activate extended functionality
44

5-
#ifndef CONFIG_USE_PSRAM
6-
# define CONFIG_USE_PSRAM true
7-
#endif
8-
#ifndef CONFIG_PSRAM_LIMIT
9-
# define CONFIG_PSRAM_LIMIT 512
10-
#endif
115
#ifndef CONFIG_SNAPCLIENT_SNTP_ENABLE
126
# define CONFIG_SNAPCLIENT_SNTP_ENABLE false
137
#endif

src/api/SnapProcessorRTOS.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class SnapProcessorRTOS : public SnapProcessor {
2929
bool begin() override {
3030
// regular begin logic
3131
bool result = SnapProcessor::begin();
32-
// empty buffer
33-
size_queue.clear();
32+
// allocate buffer, so that we could use psram
33+
size_queue.resize(RTOS_MAX_QUEUE_ENTRY_COUNT);
3434
size_queue.setWriteMaxWait(5);
35-
buffer.reset();
35+
buffer.resize(buffer_size);
3636
return result;
3737
}
3838

@@ -47,17 +47,18 @@ class SnapProcessorRTOS : public SnapProcessor {
4747
protected:
4848
const char *TAG = "SnapProcessorRTOS";
4949
audio_tools::Task task{"output", RTOS_STACK_SIZE, RTOS_TASK_PRIORITY, 1};
50-
audio_tools::QueueRTOS<size_t> size_queue{RTOS_MAX_QUEUE_ENTRY_COUNT};
50+
audio_tools::QueueRTOS<size_t> size_queue{0};
5151
audio_tools::BufferRTOS<uint8_t> buffer{0}; // size defined in constructor
5252
bool task_started = false;
5353
int active_percent;
54+
int buffer_size;
5455
static SnapProcessorRTOS *self;
5556

5657
/// store parameters provided by constructor
57-
void init_rtos(int buffer_size, int activationAtPercent) {
58+
void init_rtos(int bufferSize, int activationAtPercent) {
5859
self = this;
5960
active_percent = activationAtPercent;
60-
buffer.resize(buffer_size);
61+
buffer_size = bufferSize;
6162
}
6263

6364
/// Writes the encoded audio data to a queue
@@ -93,7 +94,7 @@ class SnapProcessorRTOS : public SnapProcessor {
9394
if (!task_started && buffer.available() > bufferTaskActivationLimit()) {
9495
ESP_LOGI(TAG, "===> starting output task");
9596
task_started = true;
96-
task.start(task_copy);
97+
task.begin(task_copy);
9798
}
9899

99100
return size_written;

0 commit comments

Comments
 (0)