Skip to content

Commit bf5c6e7

Browse files
committed
Enable board presets ! Monitor show white, Led driver sk6812 tweaks
Battery Features default on (board presets should control it) esp32-s3.ini: remove esp32-s3-stephanelec-16p, use esp32-s3-devkitc-1-n8r8v + board preset SE16, remove VOLTAGE and CURRENT PIN for the same reason Front end ======== - Monitor: add offsetWhite Back end ======= - ESP32SvelteKit: remove energy stuff (move to main) - Layouts and live scripts: remove pin and replace addPin(pin) by nextPin - Platform.ini: latest I2SClocklessLedDriver (sk6812 tweaks) - Main: add moduleIO to Lights control and drivers (for board preset pins), add loop20ms (wip) - Nodes: add *ModuleIO, add loop20ms(wip), refactor addPin to nextPin - Physical layer: replace SortedPins by ledPins, ledsPerPin and nrOfLedPins - Module drivers, lightControl, infrared: add moduleIO, readPins and updatehandler - FastLED and Physical Driver: use board presets - Infrared, add Luxceo remote, move changing to pin in moduleio readpins (from loop) -
1 parent da7669b commit bf5c6e7

File tree

32 files changed

+11634
-18895
lines changed

32 files changed

+11634
-18895
lines changed

docs/develop/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ See [Documentation](https://moonmodules.org/MoonLight/develop/documentation/)
8282
🌙 and 💫 is also used in code comments of ESP32-SvelteKit to show where changes to upstream have been made.
8383
* The following ESP32-SvelteKit features have been switched off in the default builts (they can be switched on if you want to use them, see [features.ini](https://github.com/MoonModules/MoonLight/blob/main/features.ini))
8484
* -D FT_SECURITY=0
85-
* ~~-D FT_SLEEP=1~~ enabled!
85+
* -D FT_SLEEP=0
8686
* ~~-D FT_BATTERY=1~~ enabled!
8787

8888
### UI development server

docs/develop/nodes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ A node implements the following (overloaded) functions:
1818
* ...
1919

2020
* Node types: it is recommended that a node is one of the 4 types (Effect, Modifier, Layer, Driver). However each node could perform functionality of all types. To recognize what a node does the emojis 🚥, 🔥, 💎 and ☸️ are used in the name. The function hasOnLayout() and hasModifier() indicate the specific functionality the node supports. They control when a physical to virtual mapping is recalculated
21-
* **hasOnLayout()**: a layout node specify the amount of position of lights controlled. E.g. a panel of 16x16 or a cube of 20x20x20. If hasOnLayout() is true you should implement onLayout calling addLight(position) and addPin() for all the lights.
22-
* addPin() is needed if a LED driver is used to send the output to LED strips.
21+
* **hasOnLayout()**: a layout node specify the amount of position of lights controlled. E.g. a panel of 16x16 or a cube of 20x20x20. If hasOnLayout() is true you should implement onLayout calling addLight(position) for all the lights and nextPin()
22+
* nextPin() is needed to define how many ledsPerPin are used for each pin
2323
* **hasModifier()**: a modifier node which manipulates virtual size and positions and lights using one or more of the functions modifySize, modifyPosition and modifyXYZ.
2424
* if the loop() function contains setXXX functions is used it is an **effect** node. It will contain for-loops iterating over each virtual ! light defined by layout and modifier nodes. The iteration will be on the x-axis for 1D effects, but also on the y- and z-axis for 2D and 3D effects. setRGB is the default function setting the RGB values of the light. If a light has more 'channels' (e.g. Moving heads) they also can be set.
2525
* Moving heads

docs/moonbase/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
* **Restart needed**: e.g. when drivers are changed, a restart might be needed, see 🔄 in the statusbar. Clicking on the 🔄 icon allows you to restart
2323

24-
* **Save** and **Cancel** Changes are only saved after pressing the save button 💾. To undo changes, press the cancel button 🚫 and the last saved state will be restored.
24+
* **Save** and **Cancel** Changes are only saved after pressing the save button 💾. To undo changes, press the cancel button and the last saved state will be restored.
2525

2626
* **Theme**: Light, Dark, Auto
2727

docs/moonlight/lightscontrol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Controls:
1414
* Hover with the mouse to see effects and modifiers in the preset
1515
* Double click on a saved preset to delete the preset.
1616
* Red: Selected preset
17-
* 🚨: Save (💾) or cancel (🚫 effects first, before storing them as a preset!
17+
* 🚨: Save (💾) or cancel (↻) Save effects first, before storing them as a preset!
1818
* Note: Presets only stores Effects and Modifiers, not Layers and Drivers.
1919
* Preset loop: loop over presets (seconds per presets)
2020
* Monitor On: sends LED output to the monitor.

features.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ build_flags =
66
-D FT_UPLOAD_FIRMWARE=1
77
-D FT_DOWNLOAD_FIRMWARE=1 ; requires FT_NTP=1
88
-D FT_SLEEP=0
9-
; -D FT_BATTERY=0 ; 🌙 defined in specific firmwares
9+
-D FT_BATTERY=1
1010
-D FT_ANALYTICS=1
1111
-D FT_COREDUMP=1

firmware/esp32-s3.ini

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,6 @@ lib_deps = ${esp32-s3-base.lib_deps}
6262
; RAM: [== ] 23.0% (used 75432 bytes from 327680 bytes)
6363
; Flash: [======= ] 67.8% (used 2266678 bytes from 3342336 bytes)
6464

65-
[env:esp32-s3-stephanelec-16p]
66-
board = esp32-s3-devkitc-1 ; https://github.com/platformio/platform-espressif32/blob/develop/boards/esp32-s3-devkitc-1.json
67-
board_build.arduino.memory_type = qio_opi
68-
board_build.psram_type = opi
69-
board_build.extra_flags =
70-
-DBUILD_TARGET_ESP32_S3_STEPHANELEC_16P
71-
-DBOARD_HAS_PSRAM
72-
-D FT_BATTERY=1 ; battery feature
73-
-D VOLTAGE_PIN=8
74-
-D CURRENT_PIN=9
75-
build_flags = ${esp32-s3-base.build_flags}
76-
lib_deps = ${esp32-s3-base.lib_deps}
77-
7865

7966
[env:esp32-s3-devkitc-1-n16r8v]
8067
; board = esp32-s3-devkitc-1-n16r8v ;found in boards folder
@@ -90,9 +77,6 @@ board_build.extra_flags =
9077
-DBOARD_HAS_PSRAM
9178
build_flags = ${esp32-s3-base.build_flags}
9279
-D LOLIN_WIFI_FIX ; some boards have wifi issues if this is not defined, this sets WIFI_POWER_8_5dBm
93-
-D FT_BATTERY=1 ; battery feature
94-
-D VOLTAGE_PIN=8 ; 🚧
95-
-D CURRENT_PIN=9 ; 🚧
9680
; -D FT_ETHERNET=1 ; 🚧 not implemented yet
9781
; -D USE_M5UNIFIED=1 ;for MoonManEffect (but low on heap) crashes on this board
9882
lib_deps = ${esp32-s3-base.lib_deps}

interface/src/routes/moonbase/monitor/Monitor.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
let nrOfLights: number;
5353
let channelsPerLight: number;
5454
let offsetRGB: number;
55+
let offsetWhite: number;
5556
let isPositions: boolean = false;
5657
// let offsetRed:number;
5758
// let offsetGreen:number;
@@ -73,6 +74,7 @@
7374
nrOfLights = view.getUint16(12, true); // header[12] + 256 * header[13];
7475
channelsPerLight = view.getUint8(19); //header[19];
7576
offsetRGB = view.getUint8(20); //header[20];
77+
offsetWhite = view.getUint8(21); //header[21];
7678
7779
//rebuild scene
7880
createScene(el);
@@ -130,8 +132,10 @@
130132
const r = channels[index + offsetRGB + 0] / 255;
131133
const g = channels[index + offsetRGB + 1] / 255;
132134
const b = channels[index + offsetRGB + 2] / 255;
135+
let w = 0;
136+
if (offsetWhite != 255) w = channels[index + offsetRGB + 3] / 255; //add white channel if present
133137
const a = 1.0; // Full opacity
134-
colors.push(r, g, b, a);
138+
colors.push(r + w, g + w, b + w, a);
135139
}
136140
137141
updateScene(vertices, colors);

interface/src/routes/statusbar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
💾
122122
</button>
123123
<button class="btn btn-square btn-ghost h-9 w-10" onclick={postCancelConfig}>
124-
🚫
124+
125125
</button>
126126
</div>
127127
{/if}

lib/framework/ESP32SvelteKit.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -283,30 +283,6 @@ void ESP32SvelteKit::_loop()
283283
lastTime = millis();
284284
_analyticsService.lps = lps; // 🌙
285285
lps = 0; // 🌙
286-
// 🌙
287-
#if FT_BATTERY
288-
#if BATTERY_PIN && BATTERY_MV
289-
float mVB = analogReadMilliVolts(BATTERY_PIN) * 2.0;
290-
float perc = (mVB - BATTERY_MV * 0.65) / (BATTERY_MV * 0.35); //65% of full battery is 0%, showing 0-100%
291-
// ESP_LOGD("", "bat mVB %f p:%f", mVB, perc);
292-
_batteryService.updateSOC(perc * 100);
293-
#endif
294-
#ifdef VOLTAGE_PIN //see esp32-s3-stephanelec-16p
295-
float mV = analogReadMilliVolts(VOLTAGE_PIN) * 2.0 / 1000; // /2 resistor divider
296-
_batteryService.updateVoltage(mV);
297-
#endif
298-
#ifdef CURRENT_PIN //see esp32-s3-stephanelec-16p
299-
float mA = analogReadMilliVolts(CURRENT_PIN);
300-
if (mA > 250) // datasheet unidirectional quiescent current of 0.5V. Ideally, this value should be measured at boot when nothing is displayed on the LEDs
301-
{
302-
_batteryService.updateCurrent(((mA - 250) * 50.0) / 1000); // 40mV / A with a /2 resistor divider, so a 50mA/mV
303-
}
304-
else
305-
{
306-
_batteryService.updateCurrent(0);
307-
}
308-
#endif
309-
#endif
310286
#ifdef TELEPLOT_TASKS
311287
Serial.printf(">ESP32SveltekitTask:%i:%i\n", millis(), uxTaskGetStackHighWaterMark(NULL));
312288
#endif

0 commit comments

Comments
 (0)