Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion firmware/esp32-s3.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build_flags =
${HP_ALL_DRIVERS.build_flags}
-D CONFIG_IDF_TARGET_ESP32S3=1
; -D ARDUINO_USB_MODE=1 ; which USB device classes are enabled on your ESP32 at boot. default 1 in board definition (serial only)
; -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
; -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!
; -D ARDUINO_USB_MSC_ON_BOOT=0 ;Mass Storage Class, disable
; -D ARDUINO_USB_DFU_ON_BOOT=0 ;download firmware update, disable
; -D ML_LIVE_MAPPING
Expand Down
1 change: 1 addition & 0 deletions interface/src/lib/components/moonbase/FieldRenderer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@
if (!preventClick) {
value.select = x + y * property.width + 1;
console.log('click', y, x, value.select);
if (value.selected == value.select) value.select = 255;
value.selected = value.select;
value.action = 'click';
onChange(event);
Expand Down
23,132 changes: 11,566 additions & 11,566 deletions lib/framework/WWWData.h

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,21 @@ framework = arduino ;espidf will not work as libs rely on arduino (e.g. PhysicHT
; 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
; platform_packages = framework-arduinoespressif32 @ 3.1.3

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
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.37/platform-espressif32.zip ; check latest: https://github.com/pioarduino/platform-espressif32/releases

build_flags =
${factory_settings.build_flags}
${features.build_flags}
-D BUILD_TARGET=\"$PIOENV\"
-D APP_NAME=\"MoonLight\" ; 🌙 Must only contain characters from [a-zA-Z0-9-_] as this is converted into a filename
-D APP_VERSION=\"0.8.1\" ; semver compatible version string
-D APP_DATE=\"20260212\" ; 🌙
-D APP_DATE=\"20260214\" ; 🌙

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

-D FT_MOONBASE=1

-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
-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
-D SVELTEKIT_STACK_SIZE=6144 ; psramFound() ? 8 * 1024 : 6 * 1024🌙 4096 to 8192 / 6144

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

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

; 💫 currently only enabled on s3 as esp32dev runs over 100%
Expand Down
32 changes: 31 additions & 1 deletion src/MoonBase/Modules/ModuleDevices.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,14 @@ class ModuleDevices : public Module {
for (JsonObject dev : devices) {
if (time(nullptr) - dev["lastSync"].as<time_t>() < 86400) devicesVector.push_back(dev); // max 1 day
}
std::sort(devicesVector.begin(), devicesVector.end(), [](JsonObject a, JsonObject b) { return a["name"] < b["name"]; });

std::sort(devicesVector.begin(), devicesVector.end(), [](JsonObject a, JsonObject b) {
// Primary sort: by name
if (a["name"] != b["name"]) return a["name"] < b["name"];

// Tie-breaker: by IP address (ensures stable sort)
return a["ip"] < b["ip"];
});

doc2["devices"].to<JsonArray>();
for (JsonObject device : devicesVector) {
Expand All @@ -200,6 +207,29 @@ class ModuleDevices : public Module {
JsonObject newState = doc.as<JsonObject>();
update(newState, ModuleState::update, _moduleName);
}

// JsonDocument doc2;

// // Build deduplication map: key = "name|ip", value = device
// // std::map automatically keeps entries sorted by key (name|ip)
// std::map<String, JsonObject> uniqueDevices;

// for (JsonObject dev : devices) {
// if (time(nullptr) - dev["lastSync"].as<time_t>() < 86400) { // max 1 day
// String key = String(dev["name"].as<const char*>()) + "|" + String(dev["ip"].as<const char*>());

// // Only keep the most recent entry for each name+ip combination
// if (uniqueDevices.find(key) == uniqueDevices.end() || dev["lastSync"].as<time_t>() > uniqueDevices[key]["lastSync"].as<time_t>()) {
// uniqueDevices[key] = dev;
// }
// }
// }

// // Map is already sorted by key (name|ip), just iterate and add
// doc2["devices"].to<JsonArray>();
// for (auto& pair : uniqueDevices) {
// doc2["devices"].add(pair.second);
// }
}

void receiveUDP() {
Expand Down
Loading