@geastack/targets 0.1.100 → 0.1.102

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.
Files changed (49) hide show
  1. package/package.json +7 -7
  2. package/targets/cmake/geatsc-generated-archive-build.mjs +32 -1
  3. package/targets/esp32/app_project.cmake +2 -2
  4. package/targets/esp32/chip_bindings/audio/echo_cancellation.cpp +392 -28
  5. package/targets/esp32/chip_bindings/audio/echo_cancellation.h +18 -2
  6. package/targets/esp32/chip_bindings/audio/es8311.cpp +117 -13
  7. package/targets/esp32/chip_bindings/displays/co5300.cpp +68 -28
  8. package/targets/esp32/components/gea_framework/CMakeLists.txt +17 -1
  9. package/targets/esp32/components/gea_framework/idf_component.yml +4 -0
  10. package/targets/esp32/components/gea_vpx/CMakeLists.txt +1 -1
  11. package/targets/esp32/connectivity/wifi.cpp +800 -543
  12. package/targets/esp32/display.cpp +121 -26
  13. package/targets/esp32/gea_framework.cmake +22 -28
  14. package/targets/esp32/host_sources.cmake +1 -0
  15. package/targets/esp32/services/comparison_benchmark.h +137 -0
  16. package/targets/esp32/services/comparison_gesture.h +133 -0
  17. package/targets/esp32/services/comparison_input_trace.h +64 -0
  18. package/targets/esp32/services/comparison_upload_capture.h +125 -0
  19. package/targets/esp32/services/debugger.h +634 -0
  20. package/targets/esp32/services/device_control.cpp +965 -20
  21. package/targets/esp32/services/frame_scheduler.cpp +128 -4
  22. package/targets/esp32/services/heap.cpp +125 -0
  23. package/targets/esp32/services/opus_benchmark.h +1 -1
  24. package/targets/esp32/services/storage_service.cpp +119 -104
  25. package/targets/esp32-p4-m5stack-tab5/dependencies.lock +27 -16
  26. package/targets/esp32-s3-m5stack-stopwatch/.clang-format +10 -0
  27. package/targets/esp32-s3-m5stack-stopwatch/README.md +14 -9
  28. package/targets/esp32-s3-m5stack-stopwatch/dependencies.lock +54 -1
  29. package/targets/esp32-s3-m5stack-stopwatch/main/CMakeLists.txt +10 -7
  30. package/targets/esp32-s3-m5stack-stopwatch/main/buttons.cpp +80 -0
  31. package/targets/esp32-s3-m5stack-stopwatch/main/idf_component.yml +18 -0
  32. package/targets/esp32-s3-m5stack-stopwatch/main/include/board.h +38 -17
  33. package/targets/esp32-s3-m5stack-stopwatch/main/panel_reset.cpp +132 -129
  34. package/targets/esp32-s3-m5stack-stopwatch/main/power.cpp +253 -0
  35. package/targets/esp32-s3-m5stack-stopwatch/main/touch.cpp +158 -88
  36. package/targets/esp32-s3-m5stack-stopwatch/sdkconfig.defaults +13 -0
  37. package/targets/esp32-s3-touch-amoled-1.8/main/CMakeLists.txt +30 -3
  38. package/targets/esp32-s3-touch-amoled-2.06/dependencies.lock +10 -148
  39. package/targets/esp32-s31-espressif-mosaico/CMakeLists.txt +8 -0
  40. package/targets/esp32-s31-espressif-mosaico/README.md +54 -2
  41. package/targets/esp32-s31-espressif-mosaico/dependencies.lock +405 -1
  42. package/targets/esp32-s31-espressif-mosaico/main/CMakeLists.txt +31 -1
  43. package/targets/esp32-s31-espressif-mosaico/main/board_power.cpp +117 -0
  44. package/targets/esp32-s31-espressif-mosaico/main/camera.cpp +389 -0
  45. package/targets/esp32-s31-espressif-mosaico/main/idf_component.yml +17 -3
  46. package/targets/esp32-s31-espressif-mosaico/main/include/board.h +23 -0
  47. package/targets/esp32-s31-espressif-mosaico/main/nand_mount.cpp +172 -0
  48. package/targets/esp32-s31-espressif-mosaico/partitions.csv +7 -3
  49. package/targets/esp32-s31-espressif-mosaico/sdkconfig.defaults +24 -0
@@ -3,11 +3,27 @@
3
3
  #include <cstddef>
4
4
  #include <cstdint>
5
5
 
6
+ // Two physical inputs require paired ADC slots [mic1, reference, mic2].
7
+ // They are averaged before one AEC channel; published output remains mono.
6
8
  bool geaAudioAecStart(bool hardwareReference = false, float outputGain = 1.0f,
7
- bool aggressiveNlp = true);
9
+ bool aggressiveNlp = true, unsigned microphoneCount = 1, bool adaptiveGain = false);
8
10
  void geaAudioAecStop();
9
11
  void geaAudioAecReference(const int16_t *pcm, size_t count);
10
- void geaAudioAecReceive(const int16_t *stereo, size_t count);
12
+ void geaAudioAecReceive(const int16_t *interleaved, size_t count);
11
13
  bool geaAudioAecRead(int16_t *pcm, size_t count);
12
14
  size_t geaAudioAecProcess(const int16_t *pcm, size_t count,
13
15
  const int16_t **result);
16
+
17
+ #if GEA_AUDIO_EXPERIMENT
18
+ // Lab-only runtime controls. Updates are synchronized with the DSP frame.
19
+ void geaAudioAecExperimentDefaults(float gain, bool aggressive, unsigned microphones, bool agc);
20
+ bool geaAudioAecConfigure(const char *key, float value);
21
+ void geaAudioAecDescribe(char *buffer, size_t capacity);
22
+ // Bounded diagnostic capture: interleaved physical mic1, mic2, speaker reference.
23
+ // Read only after capture has finished/stopped; never changes published audio.
24
+ bool geaAudioAecCaptureRead(size_t offset, int16_t *samples, size_t capacity,
25
+ size_t *frames, size_t *total, int64_t *startedUs,
26
+ uint32_t *drops);
27
+ bool geaAudioExperimentConfigure(const char *key, float value);
28
+ void geaAudioExperimentDescribe(char *buffer, size_t capacity);
29
+ #endif
@@ -14,6 +14,8 @@
14
14
  #include <cmath>
15
15
  #include <cstddef>
16
16
  #include <cstdint>
17
+ #include <cstdio>
18
+ #include <cstring>
17
19
  #include <mutex>
18
20
  #include <stdexcept>
19
21
  #include <vector>
@@ -32,6 +34,10 @@
32
34
 
33
35
  // Full duplex is an app opt-in. Both directions share a clock, so a live
34
36
  // capture stream cannot coexist with playback at a different sample rate.
37
+ #ifndef GEA_AUDIO_RECORD_GAIN_DB
38
+ #define GEA_AUDIO_RECORD_GAIN_DB 45.0f
39
+ #endif
40
+
35
41
  #ifndef GEA_AUDIO_FULL_DUPLEX
36
42
  #define GEA_AUDIO_FULL_DUPLEX 0
37
43
  #endif
@@ -42,6 +48,8 @@ static_assert(GEA_AUDIO_FULL_DUPLEX == 0 || GEA_AUDIO_FULL_DUPLEX == 1);
42
48
  #endif
43
49
  #if GEA_AUDIO_ECHO_CANCELLATION
44
50
  static_assert(GEA_AUDIO_FULL_DUPLEX, "Echo cancellation requires full duplex");
51
+ static_assert(gea::platform::audio::deviceSampleRate == 16000,
52
+ "Echo cancellation requires a 16000 Hz device clock");
45
53
  #include "echo_cancellation.h"
46
54
  #include "esp_heap_caps.h"
47
55
  #endif
@@ -70,6 +78,10 @@ constexpr gpio_num_t kDinPin = gea::platform::board::audio.din;
70
78
  constexpr gpio_num_t kPaPin = gea::platform::board::audio.powerAmplifier;
71
79
 
72
80
  esp_err_t setAmplifierEnabled(bool enabled) {
81
+ #if defined(GEA_EMBEDDED_COMPARISON_BENCHMARK) && GEA_EMBEDDED_COMPARISON_BENCHMARK
82
+ // Comparison runs exercise UI volume settings without producing audible output.
83
+ enabled = false;
84
+ #endif
73
85
  #if GEA_BOARD_SPEAKER_POWER
74
86
  return gea::platform::board::setSpeakerPower(enabled) ? ESP_OK : ESP_FAIL;
75
87
  #endif
@@ -114,6 +126,18 @@ constexpr int referenceMicOf(const AudioConfig &audio) {
114
126
  constexpr bool kHardwareAecReference = GEA_AUDIO_ECHO_CANCELLATION && kMicAdcAddress != 0 &&
115
127
  referenceMicOf(gea::platform::board::audio) == 3;
116
128
 
129
+ // Existing apps retain single-mic capture; dual-input boards opt in explicitly.
130
+ #ifndef GEA_AUDIO_AEC_AUTO_GAIN
131
+ #define GEA_AUDIO_AEC_AUTO_GAIN 0
132
+ #endif
133
+ static_assert(GEA_AUDIO_AEC_AUTO_GAIN == 0 || GEA_AUDIO_AEC_AUTO_GAIN == 1);
134
+ #ifndef GEA_AUDIO_AEC_MICROPHONES
135
+ #define GEA_AUDIO_AEC_MICROPHONES 1
136
+ #endif
137
+ static_assert(GEA_AUDIO_AEC_MICROPHONES == 1 || GEA_AUDIO_AEC_MICROPHONES == 2,
138
+ "AEC physical microphone count must be 1 or 2");
139
+ constexpr unsigned kAecMicrophoneCount = kHardwareAecReference ? GEA_AUDIO_AEC_MICROPHONES : 1;
140
+
117
141
  template <typename AudioConfig>
118
142
  constexpr float aecMicGainOf(const AudioConfig &audio) {
119
143
  if constexpr (requires { audio.aecMicGainDb; }) return audio.aecMicGainDb;
@@ -124,7 +148,13 @@ constexpr float aecOutputGainOf(const AudioConfig &audio) {
124
148
  if constexpr (requires { audio.aecOutputGain; }) return audio.aecOutputGain;
125
149
  return 1.0f;
126
150
  }
151
+ #ifdef GEA_AUDIO_AEC_INPUT_GAIN_DB
152
+ static_assert(GEA_AUDIO_AEC_INPUT_GAIN_DB >= 0 && GEA_AUDIO_AEC_INPUT_GAIN_DB <= 42,
153
+ "AEC microphone input gain must be between 0 and 42 dB");
154
+ constexpr float kAecMicGain = GEA_AUDIO_AEC_INPUT_GAIN_DB;
155
+ #else
127
156
  constexpr float kAecMicGain = aecMicGainOf(gea::platform::board::audio);
157
+ #endif
128
158
  #ifndef GEA_AUDIO_AEC_OUTPUT_GAIN_SCALE
129
159
  #define GEA_AUDIO_AEC_OUTPUT_GAIN_SCALE 1.0f
130
160
  #endif
@@ -293,7 +323,11 @@ public:
293
323
  }
294
324
 
295
325
  private:
296
- AudioOutputDriver() = default;
326
+ AudioOutputDriver() {
327
+ #if GEA_AUDIO_EXPERIMENT
328
+ geaAudioAecExperimentDefaults(kAecOutputGain, kAecAggressiveNlp, kAecMicrophoneCount, GEA_AUDIO_AEC_AUTO_GAIN);
329
+ #endif
330
+ }
297
331
 
298
332
  static int codecVolumeFromUserPercent(int volumePercent) {
299
333
  if (volumePercent <= 0) return 0;
@@ -310,7 +344,11 @@ private:
310
344
  void applySpeakerVolumeLocked() {
311
345
  if (!speakerCodec_) return;
312
346
  setAmplifierEnabled(speakerVolume_ > 0);
347
+ #if defined(GEA_EMBEDDED_COMPARISON_BENCHMARK) && GEA_EMBEDDED_COMPARISON_BENCHMARK
348
+ const int codecVolume = 0;
349
+ #else
313
350
  const int codecVolume = codecVolumeFromUserPercent(speakerVolume_);
351
+ #endif
314
352
  const int err = esp_codec_dev_set_out_vol(speakerCodec_, codecVolume);
315
353
  if (err != ESP_CODEC_DEV_OK) {
316
354
  ESP_LOGW(kTag, "Speaker volume set failed volume=%d codec_volume=%d err=%d", speakerVolume_, codecVolume, err);
@@ -483,9 +521,10 @@ private:
483
521
  rxConfig.clk_cfg = I2S_TDM_CLK_DEFAULT_CONFIG(static_cast<uint32_t>(sampleRate));
484
522
  rxConfig.slot_cfg = I2S_TDM_PHILIPS_SLOT_DEFAULT_CONFIG(
485
523
  I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO,
486
- static_cast<i2s_tdm_slot_mask_t>(I2S_TDM_SLOT0 | I2S_TDM_SLOT1));
487
- // ES7210 TDM order is MIC1, MIC3, MIC2, MIC4. Capture only the first
488
- // microphone and hardware reference; unselected slots consume no DMA RAM.
524
+ static_cast<i2s_tdm_slot_mask_t>(I2S_TDM_SLOT0 | I2S_TDM_SLOT1 |
525
+ (kAecMicrophoneCount == 2 ? I2S_TDM_SLOT2 : 0)));
526
+ // ES7210 TDM order is MIC1, MIC3, MIC2, MIC4. Keep both physical
527
+ // microphones and the speaker reference paired in the same DMA frame.
489
528
  rxConfig.slot_cfg.total_slot = 4;
490
529
  rxConfig.slot_cfg.ws_width = 32;
491
530
  rxConfig.gpio_cfg.mclk = kMclkPin;
@@ -608,7 +647,8 @@ private:
608
647
  sampleInfo.bits_per_sample = 16;
609
648
  sampleInfo.channel = kHardwareAecReference ? 4 : 2;
610
649
  if constexpr (kHardwareAecReference) sampleInfo.channel_mask =
611
- ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0) | ESP_CODEC_DEV_MAKE_CHANNEL_MASK(1);
650
+ ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0) | ESP_CODEC_DEV_MAKE_CHANNEL_MASK(1) |
651
+ (kAecMicrophoneCount == 2 ? ESP_CODEC_DEV_MAKE_CHANNEL_MASK(2) : 0);
612
652
  sampleInfo.sample_rate = static_cast<std::uint32_t>(sampleRate);
613
653
  sampleInfo.mclk_multiple = I2S_MCLK_MULTIPLE_256;
614
654
  err = esp_codec_dev_open(recordCodec_, &sampleInfo);
@@ -620,12 +660,23 @@ private:
620
660
  // Sensitivity is board-specific: the ES7210 loopback calibration is not
621
661
  // the ES8311 analog microphone's calibration. Keep gain before AEC low
622
662
  // enough for ADC headroom, then restore its voice level after cancellation.
623
- esp_codec_dev_set_in_gain(recordCodec_, GEA_AUDIO_ECHO_CANCELLATION ? kAecMicGain : 45.0f);
663
+ #if GEA_AUDIO_EXPERIMENT
664
+ esp_codec_dev_set_in_gain(recordCodec_, experimentAdcGain_);
665
+ #else
666
+ esp_codec_dev_set_in_gain(recordCodec_, GEA_AUDIO_ECHO_CANCELLATION ? kAecMicGain : GEA_AUDIO_RECORD_GAIN_DB);
667
+ #endif
624
668
  if constexpr (kHardwareAecReference) {
625
- // MIC1 needs sufficient near-end sensitivity at unity AEC output. An
669
+ // Both physical microphones use identical near-end gain. An
626
670
  // 18 dB PGA setting adds 6 dB over the former headroom-only setting,
627
671
  // below the previously clipping 24 dB setting. MIC3 stays independent.
628
- err = esp_codec_dev_set_in_channel_gain(recordCodec_, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0), 18.0f);
672
+ err = esp_codec_dev_set_in_channel_gain(recordCodec_, (ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0) |
673
+ (kAecMicrophoneCount == 2 ? ESP_CODEC_DEV_MAKE_CHANNEL_MASK(1) : 0)),
674
+ #if GEA_AUDIO_EXPERIMENT
675
+ experimentAdcGain_
676
+ #else
677
+ 18.0f
678
+ #endif
679
+ );
629
680
  if (err != ESP_OK) { closeRecorderLocked(); return err; }
630
681
  // Codec gain masks use physical MIC numbering, not TDM slot numbering.
631
682
  // The board attenuates the analog loopback before MIC3. At 0 dB its
@@ -635,7 +686,7 @@ private:
635
686
  if (err != ESP_OK) { closeRecorderLocked(); return err; }
636
687
  }
637
688
  #if GEA_AUDIO_ECHO_CANCELLATION
638
- if (!geaAudioAecStart(kPairedAecReference, kAecOutputGain, kAecAggressiveNlp)) { closeRecorderLocked(); return ESP_ERR_NO_MEM; }
689
+ if (!geaAudioAecStart(kPairedAecReference, kAecOutputGain, kAecAggressiveNlp, kAecMicrophoneCount, GEA_AUDIO_AEC_AUTO_GAIN)) { closeRecorderLocked(); return ESP_ERR_NO_MEM; }
639
690
  ESP_LOGI(kTag, "Microphone AEC gain: ADC=%.1f dB output=%.3f", kAecMicGain, kAecOutputGain);
640
691
  #endif
641
692
  i2sSampleRate_ = sampleRate;
@@ -755,6 +806,9 @@ private:
755
806
  int speakerSampleRate_ = 0;
756
807
  int speakerChannels_ = 0;
757
808
  int speakerBitsPerSample_ = 0;
809
+ #if GEA_AUDIO_EXPERIMENT
810
+ float experimentAdcGain_ = kHardwareAecReference ? 18.0f : kAecMicGain;
811
+ #endif
758
812
  int speakerVolume_ = 100;
759
813
  // Configuration/destruction takes write then read. A duplex read releases
760
814
  // write before blocking on RX, allowing TX to run at the same time.
@@ -767,7 +821,7 @@ private:
767
821
  std::mutex attachedMutex_;
768
822
  // Match the 20 ms Opus input frame in either duplex mode. A 2048-sample
769
823
  // half-duplex read batches 128 ms of speech before the encoder can see it.
770
- static constexpr std::size_t kCaptureFrameSamples = 320;
824
+ static constexpr std::size_t kCaptureFrameSamples = gea::platform::audio::deviceSampleRate / 50;
771
825
  std::array<std::int16_t, kCaptureFrameSamples * 2> stereoFrame_{};
772
826
  std::array<std::int16_t, kCaptureFrameSamples> monoFrame_{};
773
827
 
@@ -824,7 +878,7 @@ private:
824
878
  captureLock.unlock();
825
879
  std::lock_guard<std::mutex> configLock(writeMutex_);
826
880
  captureLock.lock();
827
- err = initRecorder(16000);
881
+ err = initRecorder(gea::platform::audio::deviceSampleRate);
828
882
  }
829
883
  if (err == ESP_OK) {
830
884
  bool ready = false;
@@ -839,7 +893,7 @@ private:
839
893
  {
840
894
  std::unique_lock<std::mutex> lock(writeMutex_);
841
895
  std::lock_guard<std::mutex> captureLock(readMutex_);
842
- err = initRecorder(16000);
896
+ err = initRecorder(gea::platform::audio::deviceSampleRate);
843
897
  if (err == ESP_OK && recordCodec_) {
844
898
  if constexpr (GEA_AUDIO_FULL_DUPLEX) lock.unlock();
845
899
  err = esp_codec_dev_read(recordCodec_, stereoFrame_.data(), stereoFrame_.size() * sizeof(std::int16_t));
@@ -876,6 +930,34 @@ private:
876
930
  }
877
931
 
878
932
  public:
933
+ #if GEA_AUDIO_EXPERIMENT
934
+ bool experimentConfigure(const char *key, float value) {
935
+ if (!key || !std::isfinite(value)) return false;
936
+ if (!std::strcmp(key, "adc_db")) {
937
+ if (value < 0 || value > 42 || std::fmod(value, 6.0f) != 0) return false;
938
+ std::lock_guard<std::mutex> writeLock(writeMutex_);
939
+ std::lock_guard<std::mutex> captureLock(readMutex_);
940
+ esp_err_t status = ESP_OK;
941
+ if (recordCodec_) {
942
+ if constexpr (kHardwareAecReference)
943
+ status = esp_codec_dev_set_in_channel_gain(recordCodec_, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0) |
944
+ (kAecMicrophoneCount == 2 ? ESP_CODEC_DEV_MAKE_CHANNEL_MASK(1) : 0), value);
945
+ else status = esp_codec_dev_set_in_gain(recordCodec_, value);
946
+ }
947
+ if (status != ESP_OK) return false;
948
+ experimentAdcGain_ = value;
949
+ return true;
950
+ }
951
+ return geaAudioAecConfigure(key, value);
952
+ }
953
+ void experimentDescribe(char *buffer, size_t capacity) {
954
+ std::lock_guard<std::mutex> captureLock(readMutex_);
955
+ char dsp[384];
956
+ geaAudioAecDescribe(dsp, sizeof(dsp));
957
+ std::snprintf(buffer, capacity, "speaker=%d adc_db=%.0f %s", speakerVolume_, experimentAdcGain_, dsp);
958
+ }
959
+ #endif
960
+
879
961
  void attachTrack(gea::host::NativeMediaTrackHandle handle) {
880
962
  std::lock_guard<std::mutex> lock(attachedMutex_);
881
963
  attachedTracks_.push_back(handle);
@@ -895,7 +977,20 @@ public:
895
977
  throw std::runtime_error("Microphone task allocation failed");
896
978
  }
897
979
  #else
898
- xTaskCreatePinnedToCore(captureTaskTrampoline, "gea_mic", 8192, this, 5, &captureTask_, 1);
980
+ // Capture does not touch flash. Keep its stack out of the DMA heap used
981
+ // by display and codec buffers, just as the AEC capture path above does.
982
+ const auto created = xTaskCreatePinnedToCoreWithCaps(
983
+ captureTaskTrampoline, "gea_mic", 8192, this, 5, &captureTask_, 1,
984
+ #if CONFIG_SPIRAM
985
+ MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
986
+ #else
987
+ MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
988
+ #endif
989
+ if (created != pdPASS) {
990
+ attachedTracks_.pop_back();
991
+ ESP_LOGE(kTag, "Microphone task allocation failed");
992
+ throw std::runtime_error("Microphone task allocation failed");
993
+ }
899
994
  #endif
900
995
  }
901
996
  }
@@ -946,3 +1041,12 @@ void platform_detach_track(NativeMediaTrackHandle handle) {
946
1041
  }
947
1042
 
948
1043
  } // namespace gea::host::media
1044
+
1045
+ #if GEA_AUDIO_EXPERIMENT
1046
+ bool geaAudioExperimentConfigure(const char *key, float value) {
1047
+ return gea::platform::esp32::chip_bindings::es8311::AudioOutputDriver::instance().experimentConfigure(key, value);
1048
+ }
1049
+ void geaAudioExperimentDescribe(char *buffer, size_t capacity) {
1050
+ gea::platform::esp32::chip_bindings::es8311::AudioOutputDriver::instance().experimentDescribe(buffer, capacity);
1051
+ }
1052
+ #endif
@@ -5,6 +5,7 @@
5
5
  #if GEA_CUSTOM_QSPI_PANEL_CONFIG
6
6
  #include "gea_qspi_panel_config.h"
7
7
  #endif
8
+ #include "services/comparison_upload_capture.h"
8
9
 
9
10
  #include <cstddef>
10
11
  #include <cstdint>
@@ -393,45 +394,73 @@ namespace gea::platform::esp32::chip_bindings::co5300
393
394
  return txParam(0x66, hbm, sizeof(hbm));
394
395
  }
395
396
 
396
- esp_err_t Panel::drawBitmap(int x0, int y0, int x1Exclusive, int y1Exclusive, const void *pixels)
397
- {
398
- if (!panel_)
397
+ esp_err_t Panel::drawBitmap(int x0, int y0, int x1Exclusive, int y1Exclusive,
398
+ const void* pixels) {
399
+ if (!panel_) {
399
400
  return ESP_ERR_INVALID_STATE;
400
- return esp_lcd_panel_draw_bitmap(panelHandle(panel_), x0, y0, x1Exclusive, y1Exclusive, pixels);
401
+ }
402
+ const auto err =
403
+ esp_lcd_panel_draw_bitmap(panelHandle(panel_), x0, y0, x1Exclusive, y1Exclusive, pixels);
404
+ #if GEA_EMBEDDED_COMPARISON_BENCHMARK
405
+ if (err == ESP_OK) {
406
+ gea::platform::comparison::upload::window(x0, y0, x1Exclusive - 1, y1Exclusive - 1);
407
+ gea::platform::comparison::upload::submitted(pixels, std::size_t(x1Exclusive - x0) *
408
+ (y1Exclusive - y0) * 2);
409
+ } else {
410
+ gea::platform::comparison::upload::failed();
411
+ }
412
+ #endif
413
+ return err;
401
414
  }
402
415
 
403
- esp_err_t Panel::setWindow(int x0, int y0, int x1, int y1)
404
- {
416
+ esp_err_t Panel::setWindow(int x0, int y0, int x1, int y1) {
405
417
  const auto window = gea::chips::co5300::CommandSet::addressWindow(x0 + kPanelXGap - gea::chips::co5300::kPanelXGap, y0 + kPanelYGap - gea::chips::co5300::kPanelYGap, x1 + kPanelXGap - gea::chips::co5300::kPanelXGap, y1 + kPanelYGap - gea::chips::co5300::kPanelYGap);
406
- ESP_RETURN_ON_ERROR(txParam(LCD_CMD_CASET, window.columns.data(), window.columns.size()), kTag, "send CASET failed");
407
- ESP_RETURN_ON_ERROR(txParam(LCD_CMD_RASET, window.rows.data(), window.rows.size()), kTag, "send RASET failed");
418
+ ESP_RETURN_ON_ERROR(txParam(LCD_CMD_CASET, window.columns.data(), window.columns.size()), kTag,
419
+ "send CASET failed");
420
+ ESP_RETURN_ON_ERROR(txParam(LCD_CMD_RASET, window.rows.data(), window.rows.size()), kTag,
421
+ "send RASET failed");
422
+ #if GEA_EMBEDDED_COMPARISON_BENCHMARK
423
+ gea::platform::comparison::upload::window(x0, y0, x1, y1);
424
+ #endif
408
425
  return ESP_OK;
409
426
  }
410
427
 
411
- esp_err_t Panel::txColor(int command, const void *color, std::size_t colorSize)
412
- {
413
- if (!panelIo_)
428
+ esp_err_t Panel::txColor(int command, const void* color, std::size_t colorSize) {
429
+ if (!panelIo_) {
414
430
  return ESP_ERR_INVALID_STATE;
431
+ }
415
432
  const int lcdCommand = gea::chips::co5300::CommandSet::qspiColorCommand(command);
416
- return esp_lcd_panel_io_tx_color(panelIoHandle(panelIo_), lcdCommand, color, colorSize);
433
+ const auto err =
434
+ esp_lcd_panel_io_tx_color(panelIoHandle(panelIo_), lcdCommand, color, colorSize);
435
+ #if GEA_EMBEDDED_COMPARISON_BENCHMARK
436
+ if (err == ESP_OK) {
437
+ if (command == LCD_CMD_RAMWR) {
438
+ gea::platform::comparison::upload::restart();
439
+ }
440
+ gea::platform::comparison::upload::submitted(color, colorSize);
441
+ } else {
442
+ gea::platform::comparison::upload::failed();
443
+ }
444
+ #endif
445
+ return err;
417
446
  }
418
447
 
419
- esp_err_t Panel::beginColorStream(int command)
420
- {
421
- if (!panelIo_ || colorStreamActive_)
448
+ esp_err_t Panel::beginColorStream(int command) {
449
+ if (!panelIo_ || colorStreamActive_) {
422
450
  return ESP_ERR_INVALID_STATE;
451
+ }
423
452
 
424
- auto *io = spiPanelIo(panelIo_);
425
- ESP_RETURN_ON_ERROR(spi_device_acquire_bus(io->spiDev, portMAX_DELAY), kTag, "acquire SPI bus failed");
453
+ auto* io = spiPanelIo(panelIo_);
454
+ ESP_RETURN_ON_ERROR(spi_device_acquire_bus(io->spiDev, portMAX_DELAY), kTag,
455
+ "acquire SPI bus failed");
426
456
 
427
457
  esp_err_t ret = drainInflight(io);
428
- if (ret != ESP_OK)
429
- {
458
+ if (ret != ESP_OK) {
430
459
  spi_device_release_bus(io->spiDev);
431
460
  return ret;
432
461
  }
433
462
 
434
- auto *lcdTrans = transDescriptorAt(io, 0);
463
+ auto* lcdTrans = transDescriptorAt(io, 0);
435
464
  std::memset(lcdTrans, 0, sizeof(LcdSpiTransDescriptor));
436
465
 
437
466
  int lcdCommand = gea::chips::co5300::CommandSet::qspiColorCommand(command);
@@ -441,24 +470,28 @@ namespace gea::platform::esp32::chip_bindings::co5300
441
470
  lcdTrans->base.length = io->lcdCmdBits;
442
471
  lcdTrans->base.tx_buffer = &lcdCommand;
443
472
  lcdTrans->base.flags |= SPI_TRANS_CS_KEEP_ACTIVE;
444
- if (io->flags.octalMode)
445
- {
446
- lcdTrans->base.flags |= SPI_TRANS_MULTILINE_CMD | SPI_TRANS_MULTILINE_ADDR | SPI_TRANS_MODE_OCT;
473
+ if (io->flags.octalMode) {
474
+ lcdTrans->base.flags |=
475
+ SPI_TRANS_MULTILINE_CMD | SPI_TRANS_MULTILINE_ADDR | SPI_TRANS_MODE_OCT;
447
476
  }
448
477
 
449
478
  ret = spi_device_polling_transmit(io->spiDev, &lcdTrans->base);
450
- if (ret != ESP_OK)
451
- {
479
+ if (ret != ESP_OK) {
452
480
  spi_device_release_bus(io->spiDev);
453
481
  return ret;
454
482
  }
455
483
 
456
484
  colorStreamActive_ = true;
485
+ #if GEA_EMBEDDED_COMPARISON_BENCHMARK
486
+ if (command == LCD_CMD_RAMWR) {
487
+ gea::platform::comparison::upload::restart();
488
+ }
489
+ #endif
457
490
  return ESP_OK;
458
491
  }
459
492
 
460
- esp_err_t Panel::queueColorStreamData(const void *color, std::size_t colorSize, bool keepCsActiveAfter, bool signalCompletion)
461
- {
493
+ esp_err_t Panel::queueColorStreamData(const void* color, std::size_t colorSize,
494
+ bool keepCsActiveAfter, bool signalCompletion) {
462
495
  if (!panelIo_ || !colorStreamActive_)
463
496
  return ESP_ERR_INVALID_STATE;
464
497
  if (!color || colorSize == 0)
@@ -530,9 +563,16 @@ namespace gea::platform::esp32::chip_bindings::co5300
530
563
  }
531
564
 
532
565
  ret = spi_device_queue_trans(io->spiDev, &lcdTrans->base, portMAX_DELAY);
533
- if (ret != ESP_OK)
566
+ if (ret != ESP_OK) {
567
+ #if GEA_EMBEDDED_COMPARISON_BENCHMARK
568
+ gea::platform::comparison::upload::failed();
569
+ #endif
534
570
  return ret;
571
+ }
535
572
  io->numTransInflight++;
573
+ #if GEA_EMBEDDED_COMPARISON_BENCHMARK
574
+ gea::platform::comparison::upload::submitted(bytes, chunkSize);
575
+ #endif
536
576
 
537
577
  bytes += chunkSize;
538
578
  remaining -= chunkSize;
@@ -12,7 +12,8 @@ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_framework.cmake")
12
12
  # capability comes from the gea CLI (env, then the -D cache entry); a direct
13
13
  # `idf.py` build leaves it unset and keeps the components, since the board is
14
14
  # then the only thing that knows what the app needs.
15
- set(GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES app_update esp_http_server gea_vpx gea_vp8_peer esp_libsrtp)
15
+ set(GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES app_update esp_http_server esp-tls)
16
+ set(GEA_EMBEDDED_FRAMEWORK_RTC_REQUIRES gea_vpx gea_vp8_peer esp_libsrtp)
16
17
  if(DEFINED ENV{GEA_EMBEDDED_CAPABILITY_NETWORK}
17
18
  AND "$ENV{GEA_EMBEDDED_CAPABILITY_NETWORK}" STREQUAL "0")
18
19
  set(GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES "")
@@ -21,6 +22,19 @@ elseif(DEFINED CACHE{GEA_EMBEDDED_CAPABILITY_NETWORK}
21
22
  set(GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES "")
22
23
  endif()
23
24
 
25
+ # HTTP/Wi-Fi alone does not require a WebRTC transport or its codecs. Keep the
26
+ # historical default unless the app explicitly excludes RTC.
27
+ set(_GEA_FRAMEWORK_RTC_ENABLED 1)
28
+ if(DEFINED ENV{GEA_EMBEDDED_CAPABILITY_RTC}
29
+ AND NOT "$ENV{GEA_EMBEDDED_CAPABILITY_RTC}" STREQUAL "")
30
+ set(_GEA_FRAMEWORK_RTC_ENABLED "$ENV{GEA_EMBEDDED_CAPABILITY_RTC}")
31
+ elseif(DEFINED CACHE{GEA_EMBEDDED_CAPABILITY_RTC})
32
+ set(_GEA_FRAMEWORK_RTC_ENABLED "$CACHE{GEA_EMBEDDED_CAPABILITY_RTC}")
33
+ endif()
34
+ if(NOT GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES OR NOT _GEA_FRAMEWORK_RTC_ENABLED)
35
+ set(GEA_EMBEDDED_FRAMEWORK_RTC_REQUIRES "")
36
+ endif()
37
+
24
38
  idf_component_register(
25
39
  SRCS
26
40
  ${GEA_FW_CXX_SOURCES}
@@ -31,9 +45,11 @@ idf_component_register(
31
45
  ${GEA_EMBEDDED_APP_LDFRAGMENT_FILES}
32
46
  REQUIRES
33
47
  esp_system
48
+ espressif__cjson
34
49
  esp_timer
35
50
  freertos
36
51
  ${GEA_EMBEDDED_FRAMEWORK_NETWORK_REQUIRES}
52
+ ${GEA_EMBEDDED_FRAMEWORK_RTC_REQUIRES}
37
53
  esp_partition
38
54
  esp_app_format
39
55
  nvs_flash
@@ -0,0 +1,4 @@
1
+ dependencies:
2
+ # Native debugger snapshots and bounded USB mutation requests. IDF 6 removed
3
+ # the built-in json component; this keeps the same cJSON API on IDF 5 and 6.
4
+ espressif/cjson: '^1.7.19'
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.24)
4
4
 
5
5
  if(COMMAND idf_component_register)
6
- idf_component_register(SRCS "vpx_memory.c" REQUIRES heap)
6
+ idf_component_register(SRCS "vpx_memory.c" REQUIRES heap esp_timer)
7
7
  if(CMAKE_SCRIPT_MODE_FILE)
8
8
  return()
9
9
  endif()