Skip to content

Commit 648609b

Browse files
authored
Merge pull request #124 from MoonModules/tube-pir-gyro
Tube gyro pir
2 parents 0601a74 + 6604c2a commit 648609b

27 files changed

Lines changed: 12113 additions & 11690 deletions

firmware/esp32-s3.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build_flags =
66
${HP_ALL_DRIVERS.build_flags}
77
-D CONFIG_IDF_TARGET_ESP32S3=1
88
; -D ARDUINO_USB_MODE=1 ; which USB device classes are enabled on your ESP32 at boot. default 1 in board definition (serial only)
9-
; -D ARDUINO_USB_CDC_ON_BOOT=1 ;Communications Device Class: controls whether the ESP32's USB serial port is enabled automatically at boot, default 1 in board definition
9+
; -D ARDUINO_USB_CDC_ON_BOOT=1 ;Communications Device Class: controls whether the ESP32's USB serial port is enabled automatically at boot, not set in board definition!
1010
; -D ARDUINO_USB_MSC_ON_BOOT=0 ;Mass Storage Class, disable
1111
; -D ARDUINO_USB_DFU_ON_BOOT=0 ;download firmware update, disable
1212
; -D ML_LIVE_MAPPING

interface/src/lib/components/moonbase/FieldRenderer.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@
361361
if (!preventClick) {
362362
value.select = x + y * property.width + 1;
363363
console.log('click', y, x, value.select);
364+
if (value.selected == value.select) value.select = 255;
364365
value.selected = value.select;
365366
value.action = 'click';
366367
onChange(event);

lib/framework/WWWData.h

Lines changed: 11566 additions & 11566 deletions
Large diffs are not rendered by default.

platformio.ini

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,21 @@ framework = arduino ;espidf will not work as libs rely on arduino (e.g. PhysicHT
4949
; platform = https://github.com/tasmota/platform-espressif32/releases/download/2025.05.30/platform-espressif32.zip ;; Platform Tasmota Arduino Core 3.1.3.250504based on IDF 5.3.3.250501platform_packages
5050
; platform_packages = framework-arduinoespressif32 @ 3.1.3
5151

52-
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.37/platform-espressif32.zip ; Sep 20, check latest: https://github.com/pioarduino/platform-espressif32/releases
52+
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.37/platform-espressif32.zip ; check latest: https://github.com/pioarduino/platform-espressif32/releases
53+
5354
build_flags =
5455
${factory_settings.build_flags}
5556
${features.build_flags}
5657
-D BUILD_TARGET=\"$PIOENV\"
5758
-D APP_NAME=\"MoonLight\" ; 🌙 Must only contain characters from [a-zA-Z0-9-_] as this is converted into a filename
5859
-D APP_VERSION=\"0.8.1\" ; semver compatible version string
59-
-D APP_DATE=\"20260212\" ; 🌙
60+
-D APP_DATE=\"20260214\" ; 🌙
6061

6162
-D PLATFORM_VERSION=\"pioarduino-55.03.37\" ; 🌙 make sure it matches with above plaftform
6263

6364
-D FT_MOONBASE=1
6465

65-
-D HTTPD_STACK_SIZE=6144 ; default 4096 but not enough for more complex read and update , 5120 not enough when switching from FastLED to parallel LED driver
66+
-D HTTPD_STACK_SIZE=8192 ; default 4096 but not enough for more complex read and update , 5120 not enough when switching from FastLED to parallel LED driver
6667
-D SVELTEKIT_STACK_SIZE=6144 ; psramFound() ? 8 * 1024 : 6 * 1024🌙 4096 to 8192 / 6144
6768

6869
; 🌙 Move ESP32SvelteKit (HTTP/WebSocket) to Core 1 (APP_CPU) to avoid WiFi preemption on Core 0
@@ -141,7 +142,9 @@ extra_scripts =
141142
scripts/save_elf.py
142143
lib_deps =
143144
ArduinoJson@>=7.0.0
144-
elims/PsychicMqttClient@^0.2.4
145+
elims/PsychicMqttClient@^0.2.4
146+
ElectronicCats/MPU6050 @ 1.3.0 ; for D_IMU.h driver
147+
; https://github.com/hanyazou/BMI160-Arduino.git ; hanyazou/BMI160-Arduino#057f36e002bee0473a54fcedf41b93acad059568 ; @ ^1.0.0 ; for BMI160
145148

146149
;💫
147150
[moonlight]
@@ -154,7 +157,7 @@ build_flags =
154157
; -D FASTLED_TESTING ; causes duplicate definition of initSpiHardware(); - workaround: removed implementation in spi_hw_manager_esp32.cpp.hpp
155158
-D FASTLED_BUILD=\"20260212\"
156159
lib_deps =
157-
https://github.com/FastLED/FastLED#ea5d2d7aadcd5697f912a1c32bb3b7e9891f949b ; master 20260212
160+
https://github.com/FastLED/FastLED#fcdbb572b3d84394845209f2bcd8fa77c2cb4ee2 ; master 20260215
158161
https://github.com/ewowi/WLED-sync#25f280b5e8e47e49a95282d0b78a5ce5301af4fe ; sourceIP + fftUdp.clear() if arduino >=3 (20251104)
159162

160163
; 💫 currently only enabled on s3 as esp32dev runs over 100%

src/MoonBase/Modules/ModuleDevices.h

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,14 @@ class ModuleDevices : public Module {
187187
for (JsonObject dev : devices) {
188188
if (time(nullptr) - dev["lastSync"].as<time_t>() < 86400) devicesVector.push_back(dev); // max 1 day
189189
}
190-
std::sort(devicesVector.begin(), devicesVector.end(), [](JsonObject a, JsonObject b) { return a["name"] < b["name"]; });
190+
191+
std::sort(devicesVector.begin(), devicesVector.end(), [](JsonObject a, JsonObject b) {
192+
// Primary sort: by name
193+
if (a["name"] != b["name"]) return a["name"] < b["name"];
194+
195+
// Tie-breaker: by IP address (ensures stable sort)
196+
return a["ip"] < b["ip"];
197+
});
191198

192199
doc2["devices"].to<JsonArray>();
193200
for (JsonObject device : devicesVector) {
@@ -200,6 +207,29 @@ class ModuleDevices : public Module {
200207
JsonObject newState = doc.as<JsonObject>();
201208
update(newState, ModuleState::update, _moduleName);
202209
}
210+
211+
// JsonDocument doc2;
212+
213+
// // Build deduplication map: key = "name|ip", value = device
214+
// // std::map automatically keeps entries sorted by key (name|ip)
215+
// std::map<String, JsonObject> uniqueDevices;
216+
217+
// for (JsonObject dev : devices) {
218+
// if (time(nullptr) - dev["lastSync"].as<time_t>() < 86400) { // max 1 day
219+
// String key = String(dev["name"].as<const char*>()) + "|" + String(dev["ip"].as<const char*>());
220+
221+
// // Only keep the most recent entry for each name+ip combination
222+
// if (uniqueDevices.find(key) == uniqueDevices.end() || dev["lastSync"].as<time_t>() > uniqueDevices[key]["lastSync"].as<time_t>()) {
223+
// uniqueDevices[key] = dev;
224+
// }
225+
// }
226+
// }
227+
228+
// // Map is already sorted by key (name|ip), just iterate and add
229+
// doc2["devices"].to<JsonArray>();
230+
// for (auto& pair : uniqueDevices) {
231+
// doc2["devices"].add(pair.second);
232+
// }
203233
}
204234

205235
void receiveUDP() {

0 commit comments

Comments
 (0)