Skip to content

Commit 42e6ec1

Browse files
committed
Merge branch 'board-preset-tuning'
2 parents 80a6496 + ec63333 commit 42e6ec1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+15061
-17498
lines changed

docs/develop/development.md

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,41 @@
77
* Make changes
88
* Document your change
99
* Submit a pull request
10-
* Develop principles: Checklist before submitting a request.
10+
11+
[Standards and Guidelines](https://moonmodules.org/MoonLight/develop/standardsguidelines/). Check before submitting a request!
1112

1213
## Create a branch
1314

14-
* Want to make changes: fork the repo (see installation)and submit pull requests, see [creating-a-pull-request-from-a-fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork):
15+
* Want to make changes: fork the repo (see installation) and submit pull requests, see [creating-a-pull-request-from-a-fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork):
1516

16-
* Press Branches, press New Branch, give it a name e.g. background-script and press Create new Branch, click on background-script
17+
* Only branch from the main branch! Press Branches, press New Branch, give it a name e.g. background-script and press Create new Branch, click on background-script
1718

18-
<img width="90" src="https://github.com/user-attachments/assets/588d0854-bac1-4b70-8931-ba6db4c94248" />
19+
<img width="90" src="https://github.com/user-attachments/assets/588d0854-bac1-4b70-8931-ba6db4c94248" />
1920

2021
## Make changes
2122

22-
### Front End (UI)
23+
### Front-end (UI)
2324

2425
* interface folder
2526
* interface/src/routes/moonbase for MoonBase and MoonLight (modules)
2627
* see [Prepare for development](https://moonmodules.org/MoonLight/develop/installation/#prepare-for-development) about nodejs, npm install
2728

28-
```
29+
```markdown
2930
npm install
3031
npm run dev
3132
```
3233

3334
* see [Troubleshooting](https://moonmodules.org/MoonLight/develop/installation/#troubleshooting) about WWWData.h
3435

35-
### Back End (Server)
36+
### Back-end (Server)
3637

3738
There are 3 levels to add functionality:
3839

39-
* **Standard ESP32-Sveltekit code**, e.g. Connections, Wifi and System. MoonBase files is also made using standard sveltekit as example but contains a few components used in MoonLight modules. Might be rewriteen as MoonLight Module in the future.
40-
* lib folder for Sveltekit back end
40+
* **Standard ESP32-Sveltekit code**, e.g. Connections, Wifi and System. MoonBase files are also made using standard SvelteKit as examples but contain a few components used in MoonLight modules. Might be rewritten as a MoonLight Module in the future.
41+
* lib folder for Sveltekit back-end
4142
* Read the [ESP32 Sveltekit docs](https://moonmodules.org/MoonLight/esp32sveltekit/)
4243
* [MoonLight Modules](https://moonmodules.org/MoonLight/moonbase/modules/) e.g. Lights Control, Effects, Info, Channels. They are subclasses of Modules.h/cpp and implement setupDefinition, onUpdate and optional loop. New modules need to be defined in main.cpp and added to menu.svelte. All further UI is generated by Module.svelte.
43-
* src folder for MoonBase and MoonLight back end
44+
* src folder for MoonBase and MoonLight back-end
4445
* **MoonLight Nodes**: the easiest and recommended way. See Effects.h, Layouts.h, Modifiers.h and Drivers.h for examples. They match closest WLED usermods. Each node has controls, a setup and a loop and can be switched on and off. For specific purposes hasOnLayout() and hasModifier() can return true.
4546
* src/MoonLight/nodes
4647

@@ -49,7 +50,7 @@ There are 3 levels to add functionality:
4950
* Go to the file(s) you want to change press edit and make the changes.
5051
* ☑️ and ➡️ to build and or upload
5152
* Changes made to the UI are not always visible in the browser, clear the browser cache to see latest UI (see [connect to MoonLight](https://moonmodules.org/MoonLight/gettingstarted/installation/#connect-moonlight)).
52-
* MoonLight uses clang-format for c/c++ code and prettier for Svelte, javascript etc. Format your code before submitting! (right click Format Document on each page you change)
53+
* MoonLight uses clang-format for c/c++ code and prettier for Svelte, javascript etc. Format your code before submitting! (right-click Format Document on each page you change)
5354
* Press Commit Changes..., enter a commit message and an extended description, Press Commit Changes
5455

5556
## Document your changes
@@ -66,7 +67,7 @@ See [Documentation](https://moonmodules.org/MoonLight/develop/documentation/)
6667

6768
* The upstream MoonLight repo can now process this PR
6869

69-
## Addtional info
70+
## Additional info
7071

7172
### Emoji coding
7273

@@ -87,9 +88,9 @@ See [Documentation](https://moonmodules.org/MoonLight/develop/documentation/)
8788

8889
### UI development server
8990

90-
To ease the frontend development you can deploy the back end code on an ESP32 board and pass the websocket and REST API calls through the development server's proxy running on your computer.
91+
To ease the front-end development you can deploy the back-end code on an ESP32 board and pass the websocket and REST API calls through the development server's proxy running on your computer.
9192

92-
This very much speeds up UI development as no flashing to ESP32 is required to test updated UI. Svaing an UI file is enough to see the results!!!
93+
This very much speeds up UI development, as no flashing to the ESP32 is required to test updated UI. Saving a UI file is enough to see the results.
9394

9495
See [Setup Proxy for Development](https://moonmodules.org/MoonLight/gettingstarted/#setup-proxy-for-development) and [development-server](https://moonmodules.org/MoonLight/gettingstarted/#development-server) how to setup.
9596

@@ -123,14 +124,3 @@ There are 3 files to consider when making a ESP32-device definition.
123124
boards/BOARD_NAME.csv
124125
boards/BOARD_NAME.JSON
125126
firmware/BOARD_TYPE_NAME.ini (e.g. esp32dev, esp32-s3), contains different boards
126-
127-
## Develop principles
128-
129-
* One firmware per board containing everything, to keep management of firmware simple - for everybody. 3MB flash space to allow for this.
130-
* Clang-format and Prettier for unified layout of code (right click format document in VSCode)
131-
* Part of submitting a change via a pull request is updated documentation. Functionality and documentation should be in one Pull Request
132-
* Make minimal changes in upstream (Sveltekit) code, as we need to stay in sync as easy as possible. Add // 🌙 to show a change has been made.
133-
* The main branch is the source to branch and merge to, no direct code commits to the main branch. As the main branch docs folder is the source for the website, doc changes can be made directly to main.
134-
* The dev branch is used for latest updates between releases. Optionally branch from dev if latest updates are needed for a change.
135-
* The src folder is for all MoonBase and MoonLight Nodes and Modules development. No need for UI changes as that is generated for Nodes and Modules. The lib folder is for upstream (Sveltekit). The interface folder is for UI, mainly Sveltekit and Modules and Nodes generic functions.
136-
* A pull request should contain compilable code and tested to not crash the system at minimal and support also boards without PSRAM, e.g. ESP32-D0. Code may be work in progress.

docs/develop/drivers.md

Lines changed: 0 additions & 100 deletions
This file was deleted.

docs/develop/installation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The development environment consists of
3838

3939
<img width="320" src="https://github.com/user-attachments/assets/74928dac-d59b-4489-b97b-759c6d792b77" />
4040

41-
* The main branch will be checked out per default. To run / test latest developments, switch to the dev branch
41+
* The main branch will be checked out per default. Latest development will be done in branches from main, merged back into main when done.
4242

4343
## Install and setup VSCode
4444

@@ -110,7 +110,7 @@ Before changing code, test if the current download of MoonLight is running fine.
110110

111111
* If you are developing or updating existing MoonLight installations MoonLight might be outdated or not show up correctly in the browser or not even appear. Two reasons
112112

113-
* Sometimes the latest front end code is not generated yet (WWWData.h). This is how to set it right:
113+
* Sometimes the latest front-end code is not generated yet (WWWData.h). This is how to set it right:
114114
* Open platformIO new terminal (>_)
115115
* touch ./interface/src/app.html so the build process will be triggered to create a new WWWData.h
116116
* build the project (✔) - if nodejs is not installed (yet) you will get errors. See troubleshooting
@@ -180,7 +180,7 @@ Before changing code, test if the current download of MoonLight is running fine.
180180

181181
### Install nodejs
182182

183-
nodejs is needed if changes on the frontend (UI) are made (interface folder). On each file change, ☑️ or ➡️ will rebuild the UI using nodejs.
183+
nodejs is needed if changes on the front-end (UI) are made (interface folder). On each file change, ☑️ or ➡️ will rebuild the UI using nodejs.
184184

185185
* Windows: if nodejs is not on your system you will get this error:
186186

docs/develop/modules.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,26 @@ ModuleDemo(PsychicHttpServer *server
3838
* Initialy create the module data
3939
4040
```cpp
41-
void setupDefinition(const JsonArray& root) override{
41+
void setupDefinition(const JsonArray& controls) override{
4242
JsonObject control; // state.data has one or more properties
43-
JsonArray details; // if a control is an array, this is the details of the array
44-
JsonArray values; // if a control is a select, this is the values of the select
45-
46-
control = root.add<JsonObject>(); control["name"] = "hostName"; control["type"] = "text"; control["default"] = "MoonLight";
47-
control = root.add<JsonObject>(); control["name"] = "connectionMode"; control["type"] = "select"; control["default"] = "Signal Strength"; values = control["values"].to<JsonArray>();
48-
values.add("Offline");
49-
values.add("Signal Strength");
50-
values.add("Priority");
51-
52-
control = root.add<JsonObject>(); control["name"] = "savedNetworks"; control["type"] = "rows"; details = control["n"].to<JsonArray>();
43+
JsonArray rows; // if a control is an array, this is the rows of the array
44+
45+
control = addControl(controls, "hostName", "text");
46+
control["default"] = "MoonLight";
47+
control = addControl(controls, "connectionMode", "select");
48+
control["default"] = "Signal Strength";
49+
addControlValue(control, "Offline");
50+
addControlValue(control, "Signal Strength");
51+
addControlValue(control, "Priority");
52+
53+
control = addControl(controls, "savedNetworks", "rows");
54+
rows = control["n"].to<JsonArray>();
5355
{
54-
control = details.add<JsonObject>(); control["name"] = "SSID"; control["type"] = "text"; control["default"] = "ewtr"; control["min"] = 3; control["max"] = 32;
55-
control = details.add<JsonObject>(); control["name"] = "Password"; control["type"] = "password"; control["default"] = "";
56+
control = addControl(rows, "SSID", "text", 3, 32);
57+
control["default"] = "ewtr";
58+
control = addControl(rows, "Password", "password");
59+
control["default"] = "";
5660
}
57-
5861
}
5962
6063
```

0 commit comments

Comments
 (0)