@geastack/targets 0.1.88 → 0.1.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/targets",
3
- "version": "0.1.88",
3
+ "version": "0.1.89",
4
4
  "description": "Native embedded build targets (ESP32-IDF, RP2350) for geastack apps: board sources, target catalog, and CMake glue driven by the gea CLI.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "@geastack/engine": "^0.1.9",
44
44
  "@geastack/geaos": "^0.1.3",
45
45
  "@geastack/geatsc-plugin-gea": "^0.1.15",
46
- "@geastack/host": "^0.1.11"
46
+ "@geastack/host": "^0.1.13"
47
47
  },
48
48
  "scripts": {
49
49
  "test": "for f in $(git ls-files | grep -E '(^|/)(test[-_][^/]*|[^/]*\\.test)\\.mjs$'); do echo \"==> $f\"; node \"$f\" || exit 1; done"
@@ -21,22 +21,26 @@ int16_t previousMic[kDmaFrames]{}, latestTx[kDmaFrames]{}, captureRef[320]{};
21
21
  uint32_t dmaWritten = 0, dmaRead = 0, dmaDrops = 0;
22
22
  bool dmaActive = false, previousMicReady = false;
23
23
  bool hardwareReference = false;
24
+ float outputGain = 1.0f;
24
25
  std::mutex aecMutex;
25
26
  aec_handle_t *aec = nullptr;
26
- alignas(16) int16_t mic[kMaxFrame], ref[kMaxFrame], clean[kMaxFrame],
27
+ alignas(16) int16_t mic[kMaxFrame], ref[kMaxFrame], clean[kMaxFrame], linear[kMaxFrame],
27
28
  output[kMaxFrame * 2];
28
29
  size_t fill = 0, frameSize = 0;
29
30
 
30
- uint64_t rawEnergy = 0, cleanEnergy = 0, refEnergy = 0, totalSamples = 0;
31
+ uint64_t rawEnergy = 0, cleanEnergy = 0, linearEnergy = 0, refEnergy = 0, totalSamples = 0;
31
32
  int64_t logAt = 0, processUs = 0;
32
33
  uint32_t processedFrames = 0, clippedSamples = 0, clippedReferenceSamples = 0;
33
34
  int rawPeak = 0, cleanPeak = 0, referencePeak = 0;
34
35
  } // namespace
35
36
 
36
- bool geaAudioAecStart(bool useHardwareReference) {
37
+ bool geaAudioAecStart(bool useHardwareReference, float gain, bool aggressiveNlp) {
37
38
  std::lock_guard<std::mutex> lock(aecMutex);
38
39
  if (aec)
39
40
  return true;
41
+ if (!std::isfinite(gain) || gain <= 0)
42
+ return false;
43
+ outputGain = gain;
40
44
  aec_config_t config{};
41
45
  config.mic_num = 1;
42
46
  config.ref_num = 1;
@@ -45,10 +49,8 @@ bool geaAudioAecStart(bool useHardwareReference) {
45
49
  config.sample_rate = 16000;
46
50
  config.caps = MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT;
47
51
  config.mode = AEC_MODE_FD_HIGH_PERF;
48
- // Use ESP-SR's default residual echo suppression in full-duplex mode.
49
- // NORMAL leaked the opening into server VAD before the adaptive filter
50
- // converged. This is AEC NLP, not noise suppression or a playback mic gate.
51
- config.nlp_level = AEC_NLP_LEVEL_AGGR;
52
+ // Select residual echo suppression independently of the output gain.
53
+ config.nlp_level = aggressiveNlp ? AEC_NLP_LEVEL_AGGR : AEC_NLP_LEVEL_NORMAL;
52
54
  aec = aec_create_from_config(&config);
53
55
  if (!aec) {
54
56
  ESP_LOGE("gea_aec", "ESP-SR AEC allocation failed");
@@ -69,14 +71,15 @@ bool geaAudioAecStart(bool useHardwareReference) {
69
71
  std::memset(latestTx, 0, sizeof(latestTx));
70
72
  dmaActive = true;
71
73
  portEXIT_CRITICAL(&dmaMux);
72
- rawEnergy = cleanEnergy = refEnergy = totalSamples = 0;
74
+ rawEnergy = cleanEnergy = linearEnergy = refEnergy = totalSamples = 0;
73
75
  processUs = processedFrames = clippedSamples = clippedReferenceSamples = 0;
74
76
  rawPeak = cleanPeak = referencePeak = 0;
75
77
  logAt = esp_timer_get_time();
76
78
  ESP_LOGI("gea_aec",
77
- "ESP-SR full-duplex high-performance AEC ready: rate=16000 frame=%u NLP=aggressive "
79
+ "ESP-SR full-duplex high-performance AEC ready: rate=16000 frame=%u NLP=%s "
78
80
  "reference=%s internal_free=%u",
79
- unsigned(frameSize), hardwareReference ? "ADC" : "TX-DMA",
81
+ unsigned(frameSize), aggressiveNlp ? "aggressive" : "normal",
82
+ hardwareReference ? "ADC" : "TX-DMA",
80
83
  unsigned(heap_caps_get_free_size(MALLOC_CAP_INTERNAL)));
81
84
  return true;
82
85
  }
@@ -109,8 +112,8 @@ void geaAudioAecReceive(const int16_t *stereo, size_t count) {
109
112
  portENTER_CRITICAL_ISR(&dmaMux);
110
113
  if (dmaActive && count == kDmaFrames * 2) {
111
114
  if (hardwareReference) {
112
- // MIC1 and the analog playback loopback are captured in the same ADC
113
- // frame. They must stay paired across callback/task scheduling jitter.
115
+ // ES7210 analog loopback or ES8311 ADCL + DACR arrive in the same RX
116
+ // frame. Keep them paired across callback/task scheduling jitter.
114
117
  if (dmaWritten - dmaRead + kDmaFrames > kCaptureRing) {
115
118
  dmaRead = dmaWritten;
116
119
  ++dmaDrops;
@@ -176,18 +179,30 @@ size_t geaAudioAecProcess(const int16_t *pcm, size_t count,
176
179
  refEnergy += int64_t(ref[j]) * ref[j];
177
180
  }
178
181
  auto before = esp_timer_get_time();
179
- aec_process(aec, mic, ref, clean);
182
+ // ESP-SR's documented two-stage API preserves both cancellation stages.
183
+ // Snapshot the linear result so telemetry can identify suppression of
184
+ // near-end speech separately from cancellation of the speaker echo.
185
+ aec_linear_process(aec, mic, ref, clean);
186
+ std::memcpy(linear, clean, frameSize * sizeof(int16_t));
187
+ aec_nlp_process(aec, clean);
180
188
  processUs += esp_timer_get_time() - before;
181
189
  ++processedFrames;
182
190
  for (size_t j = 0; j < frameSize; ++j) {
191
+ linearEnergy += int64_t(linear[j]) * linear[j];
183
192
  cleanEnergy += int64_t(clean[j]) * clean[j];
184
193
  cleanPeak = std::max(cleanPeak, std::abs(int(clean[j])));
185
194
  }
186
195
  totalSamples += frameSize;
187
- // Publish the actual cancelled signal. Makeup gain also amplifies the
188
- // residual speaker echo and undoes the suppression we just measured.
189
- // Do not gate this signal on playback: near-end speech must always pass.
190
- std::memcpy(output + produced, clean, frameSize * sizeof(int16_t));
196
+ // Apply the board's calibrated voice gain after AEC, keeping the ADC
197
+ // unclipped. Unity-gain boards retain the direct copy. Never gate speech.
198
+ if (outputGain == 1.0f) {
199
+ std::memcpy(output + produced, clean, frameSize * sizeof(int16_t));
200
+ } else {
201
+ for (size_t j = 0; j < frameSize; ++j) {
202
+ const float amplified = clean[j] * outputGain;
203
+ output[produced + j] = int16_t(std::lround(std::clamp(amplified, -32768.0f, 32767.0f)));
204
+ }
205
+ }
191
206
  produced += frameSize;
192
207
  fill = 0;
193
208
  }
@@ -195,16 +210,17 @@ size_t geaAudioAecProcess(const int16_t *pcm, size_t count,
195
210
  const auto now = esp_timer_get_time();
196
211
  if (now - logAt >= 1000000 && totalSamples) {
197
212
  ESP_LOGI("gea_aec",
198
- "raw_rms=%.0f clean_rms=%.0f ref_rms=%.0f reduction_db=%.1f "
213
+ "raw_rms=%.0f clean_rms=%.0f ref_rms=%.0f linear_rms=%.0f reduction_db=%.1f "
199
214
  "process_us=%lld dma_drops=%lu clipped=%lu ref_clipped=%lu raw_peak=%d clean_peak=%d ref_peak=%d",
200
215
  std::sqrt(double(rawEnergy) / totalSamples),
201
216
  std::sqrt(double(cleanEnergy) / totalSamples),
202
217
  std::sqrt(double(refEnergy) / totalSamples),
218
+ std::sqrt(double(linearEnergy) / totalSamples),
203
219
  10 * std::log10(double(rawEnergy + 1) / double(cleanEnergy + 1)),
204
220
  (long long)(processUs / std::max<uint32_t>(1, processedFrames)),
205
221
  (unsigned long)dmaDrops, (unsigned long)clippedSamples,
206
222
  (unsigned long)clippedReferenceSamples, rawPeak, cleanPeak, referencePeak);
207
- rawEnergy = cleanEnergy = refEnergy = totalSamples = 0;
223
+ rawEnergy = cleanEnergy = linearEnergy = refEnergy = totalSamples = 0;
208
224
  rawPeak = cleanPeak = referencePeak = 0;
209
225
  processUs = processedFrames = clippedSamples = clippedReferenceSamples = 0;
210
226
  logAt = now;
@@ -3,7 +3,8 @@
3
3
  #include <cstddef>
4
4
  #include <cstdint>
5
5
 
6
- bool geaAudioAecStart(bool hardwareReference = false);
6
+ bool geaAudioAecStart(bool hardwareReference = false, float outputGain = 1.0f,
7
+ bool aggressiveNlp = true);
7
8
  void geaAudioAecStop();
8
9
  void geaAudioAecReference(const int16_t *pcm, size_t count);
9
10
  void geaAudioAecReceive(const int16_t *stereo, size_t count);
@@ -105,6 +105,34 @@ constexpr int referenceMicOf(const AudioConfig &audio) {
105
105
  constexpr bool kHardwareAecReference = GEA_AUDIO_ECHO_CANCELLATION && kMicAdcAddress != 0 &&
106
106
  referenceMicOf(gea::platform::board::audio) == 3;
107
107
 
108
+ template <typename AudioConfig>
109
+ constexpr float aecMicGainOf(const AudioConfig &audio) {
110
+ if constexpr (requires { audio.aecMicGainDb; }) return audio.aecMicGainDb;
111
+ return 12.0f;
112
+ }
113
+ template <typename AudioConfig>
114
+ constexpr float aecOutputGainOf(const AudioConfig &audio) {
115
+ if constexpr (requires { audio.aecOutputGain; }) return audio.aecOutputGain;
116
+ return 1.0f;
117
+ }
118
+ constexpr float kAecMicGain = aecMicGainOf(gea::platform::board::audio);
119
+ constexpr float kAecOutputGain = aecOutputGainOf(gea::platform::board::audio);
120
+ template <typename AudioConfig>
121
+ constexpr bool aecAggressiveNlpOf(const AudioConfig &audio) {
122
+ if constexpr (requires { audio.aecAggressiveNlp; }) return audio.aecAggressiveNlp;
123
+ return true;
124
+ }
125
+ constexpr bool kAecAggressiveNlp = aecAggressiveNlpOf(gea::platform::board::audio);
126
+ template <typename AudioConfig>
127
+ constexpr bool codecReferenceOf(const AudioConfig &audio) {
128
+ if constexpr (requires { audio.aecCodecReference; }) return audio.aecCodecReference;
129
+ return false;
130
+ }
131
+ // ES8311's ADCL + DACR mode returns mic and DAC reference in one RX frame.
132
+ // This changes AEC pairing, not the ES7210-specific TDM/clock configuration.
133
+ constexpr bool kPairedAecReference = kHardwareAecReference ||
134
+ (GEA_AUDIO_ECHO_CANCELLATION && codecReferenceOf(gea::platform::board::audio));
135
+
108
136
  class AudioOutputDriver {
109
137
  public:
110
138
  static AudioOutputDriver &instance() {
@@ -423,7 +451,7 @@ private:
423
451
  #if GEA_AUDIO_ECHO_CANCELLATION
424
452
  i2s_event_callbacks_t txCallbacks{};
425
453
  txCallbacks.on_sent = txSent;
426
- err = kHardwareAecReference ? ESP_OK : i2s_channel_register_event_callback(txChannel_, &txCallbacks, this);
454
+ err = kPairedAecReference ? ESP_OK : i2s_channel_register_event_callback(txChannel_, &txCallbacks, this);
427
455
  if (err != ESP_OK) { releaseI2s(); return err; }
428
456
  #endif
429
457
  err = i2s_channel_enable(txChannel_);
@@ -572,11 +600,10 @@ private:
572
600
  return err;
573
601
  }
574
602
  recordOpen_ = true;
575
- // Keep ADC headroom for loud speaker echo. No digital makeup gain follows
576
- // AEC; calibrate the physical microphone independently of the loopback.
577
- // Playback peaks clipped the ADC at 24 dB, producing nonlinear echo that
578
- // AEC cannot subtract; keep the microphone below that clipping setting.
579
- esp_codec_dev_set_in_gain(recordCodec_, GEA_AUDIO_ECHO_CANCELLATION ? 12.0f : 45.0f);
603
+ // Sensitivity is board-specific: the ES7210 loopback calibration is not
604
+ // the ES8311 analog microphone's calibration. Keep gain before AEC low
605
+ // enough for ADC headroom, then restore its voice level after cancellation.
606
+ esp_codec_dev_set_in_gain(recordCodec_, GEA_AUDIO_ECHO_CANCELLATION ? kAecMicGain : 45.0f);
580
607
  if constexpr (kHardwareAecReference) {
581
608
  // MIC1 needs sufficient near-end sensitivity at unity AEC output. An
582
609
  // 18 dB PGA setting adds 6 dB over the former headroom-only setting,
@@ -591,7 +618,8 @@ private:
591
618
  if (err != ESP_OK) { closeRecorderLocked(); return err; }
592
619
  }
593
620
  #if GEA_AUDIO_ECHO_CANCELLATION
594
- if (!geaAudioAecStart(kHardwareAecReference)) { closeRecorderLocked(); return ESP_ERR_NO_MEM; }
621
+ if (!geaAudioAecStart(kPairedAecReference, kAecOutputGain, kAecAggressiveNlp)) { closeRecorderLocked(); return ESP_ERR_NO_MEM; }
622
+ ESP_LOGI(kTag, "Microphone AEC gain: ADC=%.1f dB output=%.3f", kAecMicGain, kAecOutputGain);
595
623
  #endif
596
624
  i2sSampleRate_ = sampleRate;
597
625
  return ESP_OK;
@@ -554,6 +554,10 @@ private:
554
554
  gea::platform::display::Display::reserveInternal(56 * 1024);
555
555
  const bool connected = self->init();
556
556
  if (connected) gea::framework::services::NetworkServices::startDeferredServers();
557
+ // Bring-up has finished allocating WiFi and server resources. Release
558
+ // the temporary reservation so display staging can grow to whatever
559
+ // now fits; retaining it pins every connected app to two-row transfers.
560
+ gea::platform::display::Display::reserveInternal(0);
557
561
  self->bringingUp_ = false;
558
562
  vTaskDeleteWithCaps(nullptr);
559
563
  }
@@ -62,6 +62,12 @@ namespace pixel = gea::framework::graphics::pixel;
62
62
  namespace qspi_panel = gea::platform::esp32::chip_bindings::displays;
63
63
  namespace present = gea::framework::display_present;
64
64
 
65
+ // Persistent transfer evidence, independent of serial logging or perf builds.
66
+ static std::atomic<uint32_t> gCompletedDisplayChunks{0};
67
+ extern "C" uint32_t gea_display_completed_chunks() {
68
+ return gCompletedDisplayChunks.load(std::memory_order_relaxed);
69
+ }
70
+
65
71
  // Cross-core raster: run a chunk's fill on the idle CPU (both the app frame task
66
72
  // and the present task are pinned to APP_FRAME_TASK_CORE) while the present task
67
73
  // streams the previous chunk. Defined later in this file. submit() returns false
@@ -80,6 +86,7 @@ constexpr bool kGea3dTryFullFramePsram = false;
80
86
  namespace gea::platform::esp32::display
81
87
  {
82
88
 
89
+
83
90
  #ifndef GEA_EMBEDDED_DISPLAY_QSPI_PCLK_HZ
84
91
  #define GEA_EMBEDDED_DISPLAY_QSPI_PCLK_HZ (80 * 1000 * 1000)
85
92
  #endif
@@ -2957,6 +2964,7 @@ namespace gea::platform::esp32::display
2957
2964
  auto *self = static_cast<DisplayBackend *>(userContext);
2958
2965
  if (!self || !self->flushSlots_)
2959
2966
  return false;
2967
+ gCompletedDisplayChunks.fetch_add(1, std::memory_order_relaxed);
2960
2968
  #if GEA_EMBEDDED_DISPLAY_PRESENT_SPLIT_LOG
2961
2969
  // TEMP wire probe (gea3d present-path work): per-chunk DMA completion
2962
2970
  // timestamps; paired with kick timestamps to derive real chunk service
@@ -9,6 +9,9 @@
9
9
  #include "pixel.h"
10
10
  #include "touch.h" // Touchscreen::injectEvent for GEADEV DRAG/SWIPE
11
11
  #include "wifi.h" // network::wifi() for GEADEV PING ip=/mac=
12
+ #include "host/video.h"
13
+
14
+ extern "C" uint32_t gea_display_completed_chunks() __attribute__((weak));
12
15
  #include "services/app_state.h"
13
16
  #include "services/storage_service.h"
14
17
  #include "ui/internal.h"
@@ -1511,9 +1514,8 @@ void handlePlayFile(char *args)
1511
1514
  std::printf("GEADEV:PLAYFILE %s path=%s\n", ok ? "OK" : "ERR", path);
1512
1515
  }
1513
1516
 
1514
- void printNetworkDiagnostics()
1517
+ void printTaskDiagnostics(bool networkOnly)
1515
1518
  {
1516
- std::printf("GEADEV:NETDIAG BEGIN\n");
1517
1519
  #if configUSE_TRACE_FACILITY && INCLUDE_xTaskGetHandle
1518
1520
  struct Sample {
1519
1521
  const char *name;
@@ -1521,16 +1523,21 @@ void printNetworkDiagnostics()
1521
1523
  configRUN_TIME_COUNTER_TYPE cpu = 0;
1522
1524
  std::int64_t at = 0;
1523
1525
  };
1524
- static Sample samples[] = {{"wifi"}, {"tcpip"}, {"websocket_task"}, {"gea-ws-send"}};
1526
+ static Sample samples[] = {{"wifi"}, {"tcpip"}, {"websocket_task"}, {"gea-ws-send"},
1527
+ {"gea_runtime"}, {"app_frame"}, {"gea_mic"}, {"gea_audio"},
1528
+ {"gea_mjpeg_dec"}, {"gea_mjpeg_rx"}, {"gea_rwrk"}, {"IDLE0"}, {"IDLE1"}};
1529
+ const char *prefix = networkOnly ? "NETDIAG" : "TASKSTATS";
1530
+ unsigned index = 0;
1525
1531
  for (auto &sample : samples) {
1532
+ if (networkOnly && index++ >= 4) break;
1526
1533
  const TaskHandle_t task = xTaskGetHandle(sample.name);
1527
1534
  if (!task) {
1528
- std::printf("GEADEV:NETDIAG task=%s absent=1\n", sample.name);
1535
+ std::printf("GEADEV:%s task=%s absent=1\n", prefix, sample.name);
1529
1536
  sample.at = 0;
1530
1537
  continue;
1531
1538
  }
1532
1539
  TaskStatus_t info{};
1533
- // Inspect these four tasks only; never scan stacks or enumerate all tasks.
1540
+ // Inspect known media/runtime tasks only, without scanning their stacks.
1534
1541
  vTaskGetInfo(task, &info, pdFALSE, eInvalid);
1535
1542
  const auto now = esp_timer_get_time();
1536
1543
  const bool previous = sample.at && sample.taskNumber == info.xTaskNumber;
@@ -1543,9 +1550,11 @@ void printNetworkDiagnostics()
1543
1550
  case eDeleted: state = "deleted"; break;
1544
1551
  default: break;
1545
1552
  }
1546
- std::printf("GEADEV:NETDIAG task=%s id=%u state=%s priority=%u cpu_ticks=%llu delta_ticks=%llu span_us=%lld\n",
1547
- sample.name, static_cast<unsigned>(info.xTaskNumber), state,
1553
+ std::printf("GEADEV:%s task=%s id=%u state=%s priority=%u base_priority=%u core=%d cpu_ticks=%llu delta_ticks=%llu span_us=%lld\n",
1554
+ prefix, sample.name, static_cast<unsigned>(info.xTaskNumber), state,
1548
1555
  static_cast<unsigned>(info.uxCurrentPriority),
1556
+ static_cast<unsigned>(info.uxBasePriority),
1557
+ static_cast<int>(xTaskGetCoreID(task)),
1549
1558
  static_cast<unsigned long long>(info.ulRunTimeCounter),
1550
1559
  static_cast<unsigned long long>(previous ? info.ulRunTimeCounter - sample.cpu : 0),
1551
1560
  static_cast<long long>(previous ? now - sample.at : 0));
@@ -1556,6 +1565,12 @@ void printNetworkDiagnostics()
1556
1565
  #else
1557
1566
  std::printf("GEADEV:NETDIAG task-stats-unavailable\n");
1558
1567
  #endif
1568
+ }
1569
+
1570
+ void printNetworkDiagnostics()
1571
+ {
1572
+ std::printf("GEADEV:NETDIAG BEGIN\n");
1573
+ printTaskDiagnostics(true);
1559
1574
  #if CONFIG_ESP_WIFI_ENABLED
1560
1575
  // The Wi-Fi driver owns these counters; use its public diagnostic entry.
1561
1576
  // Emit the marker first so USB also locates a blocked driver dump.
@@ -1629,6 +1644,54 @@ void handleCommand(char *line, CommandSource source)
1629
1644
  } else if (tokenEquals(command, "APP")) {
1630
1645
  const char *appId = gea::framework::apps::AppManager::currentId();
1631
1646
  std::printf("GEADEV:APP id=%s\n", appId ? appId : "");
1647
+ } else if (tokenEquals(command, "TASKSTATS")) {
1648
+ std::puts("GEADEV:TASKSTATS BEGIN");
1649
+ printTaskDiagnostics(false);
1650
+ std::puts("GEADEV:TASKSTATS END");
1651
+ } else if (tokenEquals(command, "VIDEOSTATS")) {
1652
+ gea::framework::services::AppState::lock();
1653
+ const auto stats = gea::host::HTMLVideoElement::presentationStats();
1654
+ gea::framework::services::AppState::unlock();
1655
+ std::printf("GEADEV:VIDEOSTATS decoded=%u selected=%u max_gap_ms=%u dma_chunks=%u\n",
1656
+ unsigned(stats.decoded), unsigned(stats.selected), unsigned(stats.maxGapMs),
1657
+ unsigned(gea_display_completed_chunks ? gea_display_completed_chunks() : 0));
1658
+ } else if (tokenEquals(command, "VIDEO")) {
1659
+ // Replay a local diagnostic clip through the real video/render path,
1660
+ // without creating a hosted session or opening microphone hardware.
1661
+ static gea::host::HTMLVideoElement retainedVideo;
1662
+ const char *className = nextToken(cursor);
1663
+ const char *url = nextToken(cursor);
1664
+ if (!className || !url) {
1665
+ std::puts("GEADEV:ERR VIDEO usage=GEADEV_VIDEO_class_url|STOP");
1666
+ } else {
1667
+ gea::framework::services::AppState::lock();
1668
+ auto &tree = gea::embedded::ui::Tree::instance();
1669
+ bool found = false;
1670
+ for (int id = 0; id < tree.nodeCount(); ++id) {
1671
+ if (!tree.hasClass(id, className)) continue;
1672
+ const gea::embedded::ui::NodeHandle node(id);
1673
+ gea::host::HTMLVideoElement video{node};
1674
+ const bool stopping = tokenEquals(url, "STOP");
1675
+ node.classList().toggle("ready", !stopping);
1676
+ for (int cover = 0; cover < tree.nodeCount(); ++cover) {
1677
+ if (tree.hasClass(cover, "portrait"))
1678
+ gea::embedded::ui::NodeHandle(cover).classList().toggle("hidden", !stopping);
1679
+ }
1680
+ if (stopping) {
1681
+ video.pause();
1682
+ video.setSrcObject(nullptr);
1683
+ retainedVideo = {};
1684
+ } else {
1685
+ retainedVideo = video;
1686
+ video.setSrc(url);
1687
+ video.play();
1688
+ }
1689
+ found = true;
1690
+ break;
1691
+ }
1692
+ gea::framework::services::AppState::unlock();
1693
+ std::printf("GEADEV:VIDEO %s\n", found ? "OK" : "missing-node");
1694
+ }
1632
1695
  } else if (tokenEquals(command, "MEM")) {
1633
1696
  const unsigned intFree = static_cast<unsigned>(heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
1634
1697
  const unsigned intTotal = static_cast<unsigned>(heap_caps_get_total_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT));
@@ -1639,10 +1702,13 @@ void handleCommand(char *line, CommandSource source)
1639
1702
  const unsigned psramLargest = static_cast<unsigned>(heap_caps_get_largest_free_block(MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT));
1640
1703
  const char *appId = gea::framework::apps::AppManager::currentId();
1641
1704
  std::printf(
1642
- "GEADEV:MEM app=%s internal_used=%u internal_free=%u internal_total=%u internal_largest=%u internal_min_free=%u psram_used=%u psram_free=%u psram_total=%u psram_largest=%u\n",
1705
+ "GEADEV:MEM app=%s internal_used=%u internal_free=%u internal_total=%u internal_largest=%u internal_min_free=%u psram_used=%u psram_free=%u psram_total=%u psram_largest=%u flush_rows=%d flush_depth=%d flush_bytes=%d\n",
1643
1706
  appId ? appId : "",
1644
1707
  intTotal - intFree, intFree, intTotal, intLargest, intMinFree,
1645
- psramTotal - psramFree, psramFree, psramTotal, psramLargest);
1708
+ psramTotal - psramFree, psramFree, psramTotal, psramLargest,
1709
+ gea::platform::display::Display::flushChunkRows(),
1710
+ gea::platform::display::Display::flushQueueDepth(),
1711
+ gea::platform::display::Display::flushBufferBytes());
1646
1712
  } else if (tokenEquals(command, "HEAPTRACE")) {
1647
1713
  #if CONFIG_HEAP_TRACING_STANDALONE
1648
1714
  // Allocate records only on demand, outside internal DMA RAM. Emit
@@ -152,7 +152,14 @@ constexpr int kTaskStackWords = GEA_EMBEDDED_APP_FRAME_TASK_STACK_WORDS;
152
152
  #ifndef GEA_EMBEDDED_APP_FRAME_TASK_STACK_EXTERNAL
153
153
  #define GEA_EMBEDDED_APP_FRAME_TASK_STACK_EXTERNAL 0
154
154
  #endif
155
+ #if defined(GEA_EMBEDDED_APP_USES_AUDIO) && GEA_EMBEDDED_APP_USES_AUDIO && defined(GEA_EMBEDDED_RUNTIME_TASK_PRIORITY)
156
+ // The ticker takes AppState's mutex. If it outranks the media app's runtime,
157
+ // priority inheritance promotes the renderer above the JPEG/network workers
158
+ // for the entire render. Keep both sides of that lock at the app's priority.
159
+ constexpr int kTaskPriority = GEA_EMBEDDED_RUNTIME_TASK_PRIORITY;
160
+ #else
155
161
  constexpr int kTaskPriority = GEA_EMBEDDED_APP_FRAME_TASK_PRIORITY;
162
+ #endif
156
163
  #ifndef GEA_EMBEDDED_APP_FRAME_TASK_CORE
157
164
  // -1 = tskNO_AFFINITY (run on either core). Boards with BT/WiFi pinned to a
158
165
  // specific core can override this to put the frame task on the other core,
@@ -105,6 +105,20 @@ dependencies:
105
105
  registry_url: https://components.espressif.com/
106
106
  type: service
107
107
  version: 1.5.9
108
+ espressif/esp_h264:
109
+ component_hash: 3d60078419ceac61cd87579664ae6a5a9b9a42d6f2edf4e23d753af8d2a67da9
110
+ dependencies:
111
+ - name: idf
112
+ require: private
113
+ version: '>=4.4'
114
+ source:
115
+ registry_url: https://components.espressif.com/
116
+ type: service
117
+ targets:
118
+ - esp32s3
119
+ - esp32s31
120
+ - esp32p4
121
+ version: 1.4.1
108
122
  espressif/esp_io_expander:
109
123
  component_hash: 7b7f91270172e46ca4597e3874f48d8412e280e8c295559f5922ec38656e3e5f
110
124
  dependencies:
@@ -202,12 +216,13 @@ direct_dependencies:
202
216
  - espressif/esp-sr
203
217
  - espressif/esp_audio_codec
204
218
  - espressif/esp_codec_dev
219
+ - espressif/esp_h264
205
220
  - espressif/esp_lcd_panel_io_additions
206
221
  - espressif/esp_lcd_sh8601
207
222
  - espressif/esp_new_jpeg
208
223
  - espressif/esp_peer
209
224
  - espressif/esp_websocket_client
210
225
  - idf
211
- manifest_hash: 05c57d96aa0b34e57a5a3a283315ffdeb977120a8bb1f7caf3f2235d6c0e6577
226
+ manifest_hash: 7a2fdbc750c2e657f8c7b4613b18bcb01c31cce82dcd618039369e3b5fcb4c99
212
227
  target: esp32s3
213
228
  version: 3.0.0
@@ -1,4 +1,8 @@
1
1
  dependencies:
2
+ espressif/esp_h264:
3
+ version: '==1.4.1'
4
+ rules:
5
+ - if: '$GEA_EMBEDDED_CAPABILITY_NETWORK == 1'
2
6
  espressif/esp_new_jpeg: '==1.0.2'
3
7
  espressif/esp-sr:
4
8
  version: '==2.5.5'
@@ -36,6 +36,10 @@ struct Es8311AudioConfig {
36
36
  gpio_num_t dout;
37
37
  gpio_num_t din;
38
38
  gpio_num_t powerAmplifier;
39
+ float aecMicGainDb;
40
+ float aecOutputGain;
41
+ bool aecCodecReference;
42
+ bool aecAggressiveNlp;
39
43
  };
40
44
 
41
45
  class Esp32S3TouchAmoled18 {
@@ -70,6 +74,14 @@ public:
70
74
  .dout = GPIO_NUM_8,
71
75
  .din = GPIO_NUM_10,
72
76
  .powerAmplifier = GPIO_NUM_46,
77
+ // This ES8311 microphone needs its own calibration and double-talk
78
+ // setting: aggressive NLP erased measured near-end speech at full volume.
79
+ .aecMicGainDb = 24.0f,
80
+ // Match the 2.06's +9 dB increase relative to this microphone's own
81
+ // calibrated 18.8364909 baseline; retain ADC and echo-reference settings.
82
+ .aecOutputGain = 53.0884444f,
83
+ .aecCodecReference = true,
84
+ .aecAggressiveNlp = false,
73
85
  };
74
86
  };
75
87
 
@@ -172,7 +172,7 @@ dependencies:
172
172
  component_hash: e1e7e6991193c41ed6c9fc386702aa7821433319e7aa9c3147cd3236310cd69c
173
173
  dependencies: []
174
174
  source:
175
- registry_url: https://components.espressif.com
175
+ registry_url: https://components.espressif.com/
176
176
  type: service
177
177
  targets:
178
178
  - esp32
@@ -219,9 +219,10 @@ direct_dependencies:
219
219
  - espressif/esp_h264
220
220
  - espressif/esp_lcd_co5300
221
221
  - espressif/esp_lcd_panel_io_additions
222
+ - espressif/esp_new_jpeg
222
223
  - espressif/esp_peer
223
224
  - espressif/esp_websocket_client
224
225
  - idf
225
- manifest_hash: 8042114f8e64bc150dfc3eb9ea5ed30cb9eace6cc596df7e877ec83a850d312a
226
+ manifest_hash: 0dc57984fca8a1c7d21cd93f23e3f0722d046fd111c214224bcb9fed7be4746f
226
227
  target: esp32s3
227
228
  version: 3.0.0
@@ -597,6 +597,7 @@ if(NOT GEA_APP_CANVAS_ONLY)
597
597
  endif()
598
598
  if(GEA_EMBEDDED_CAPABILITY_NETWORK)
599
599
  list(APPEND GEA_EMBEDDED_TARGET_REQUIRES
600
+ esp_new_jpeg
600
601
  lwip
601
602
  esp_wifi
602
603
  esp_http_server
@@ -6,6 +6,11 @@
6
6
  # direct `idf.py` build keeps everything (and so the component manager never
7
7
  # sees an unset variable, which it treats as an error).
8
8
  dependencies:
9
+ # host/mjpeg.cpp needs this header in main, not only gea_framework.
10
+ espressif/esp_new_jpeg:
11
+ version: '==1.0.2'
12
+ rules:
13
+ - if: '$GEA_EMBEDDED_CAPABILITY_NETWORK == 1'
9
14
  espressif/esp_h264:
10
15
  version: '^1.4.1'
11
16
  rules:
@@ -47,6 +47,9 @@ struct Es8311AudioConfig {
47
47
  int es7210Address;
48
48
  // Physical ES7210 input wired to the ES8311 analog playback reference.
49
49
  int es7210ReferenceMic;
50
+ // Calibrate the cancelled near-end signal without clipping the ADC on echo.
51
+ float aecOutputGain;
52
+ bool aecAggressiveNlp;
50
53
  };
51
54
 
52
55
  struct SdMmcConfig {
@@ -99,6 +102,10 @@ public:
99
102
  .powerAmplifier = GPIO_NUM_46,
100
103
  .es7210Address = 0x40,
101
104
  .es7210ReferenceMic = 3,
105
+ // +9 dB after cancellation improves normal-voice interruption sensitivity
106
+ // without raising the ADC level or the speaker reference gain.
107
+ .aecOutputGain = 53.3408610f,
108
+ .aecAggressiveNlp = false,
102
109
  };
103
110
  };
104
111