Skip to content

Commit a0e2418

Browse files
committed
ModuleIO - Choice between push and toggle buttons
1 parent d83f887 commit a0e2418

File tree

5 files changed

+39
-37
lines changed

5 files changed

+39
-37
lines changed

docs/moonbase/inputoutput.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ For each board the following presets are defined:
2727
## Pin usage
2828

2929
* Supported
30-
* LEDs: Used by LED drivers to setup LED outputs, see [Drivers](../../moonlight/drivers/)
31-
* Voltage and Current: Sets energy monitoring, see [System status](../../system/status) and [System Metrics](../../system/metrics)
32-
* Infrared: Used by IR driver, see [Drivers](../../moonlight/drivers/)
33-
* Button LightsOn: sets on/off in [Light Control](../../moonlight/lightscontrol/)
34-
* Relay LightsOn: sets on/off in [Light Control](../../moonlight/lightscontrol/)
35-
* SPI_SCK, SPI_MISO, SPI_MOSI, PHY_CS, PHY_IRQ: S3 Ethernet, Used by the Ethernet module, see [Ethernet](../../network/ethernet/)
30+
* LEDs 🚦: Used by LED drivers to setup LED outputs, see [Drivers](../../moonlight/drivers/)
31+
* Voltage and Current ⚡️: Sets energy monitoring, see [System status](../../system/status) and [System Metrics](../../system/metrics)
32+
* Infrared ♨️: Used by IR driver, see [Drivers](../../moonlight/drivers/)
33+
* Button LightsOn 🛎️/𓐟: sets on/off in [Light Control](../../moonlight/lightscontrol/), Push (🛎️) and Toggle (𓐟)
34+
* Relay LightsOn 🔀: sets on/off in [Light Control](../../moonlight/lightscontrol/)
35+
* SPI_SCK, SPI_MISO, SPI_MOSI, PHY_CS, PHY_IRQ 🔗: S3 Ethernet, Used by the Ethernet module, see [Ethernet](../../network/ethernet/)
3636
* Planned soon
3737
* Battery
38-
* DMX (in)
38+
* DMX
3939
* Planned later
4040
* I2S for microphone and line in
4141
* I2C

src/MoonBase/Modules/ModuleIO.h

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ enum IO_PinUsageEnum {
3232
pin_I2C_SCL,
3333
pin_ButtonPush,
3434
pin_ButtonToggle,
35-
pin_Button_LightsOn,
35+
pin_Button_Push_LightsOn,
36+
pin_Button_Toggle_LightsOn,
3637
pin_Relay,
3738
pin_Relay_LightsOn,
3839
pin_Voltage,
@@ -43,7 +44,6 @@ enum IO_PinUsageEnum {
4344
pin_OnBoardKey,
4445
pin_Battery,
4546
pin_Temperature,
46-
pin_Exposed,
4747
pin_SDIO_PIN_CMD,
4848
pin_SDIO_PIN_CLK,
4949
pin_SDIO_PIN_D0,
@@ -61,6 +61,7 @@ enum IO_PinUsageEnum {
6161
pin_RS485_TX,
6262
pin_RS485_RX,
6363
pin_Dig_Input, // Digital Input pin type. May contains some protection circuit
64+
pin_Exposed,
6465
pin_Reserved,
6566
pin_count
6667
};
@@ -146,7 +147,7 @@ class ModuleIO : public Module {
146147
control = addControl(rows, "usage", "select");
147148
control["default"] = 0;
148149
addControlValue(control, "Unused"); // 0
149-
addControlValue(control, "LED");
150+
addControlValue(control, "LED 🚦");
150151
addControlValue(control, "LED CW");
151152
addControlValue(control, "LED WW");
152153
addControlValue(control, "LED R");
@@ -158,20 +159,20 @@ class ModuleIO : public Module {
158159
addControlValue(control, "I2S MCLK");
159160
addControlValue(control, "I2C SDA");
160161
addControlValue(control, "I2C SCL");
161-
addControlValue(control, "Button Push");
162-
addControlValue(control, "Button Toggle");
163-
addControlValue(control, "Button LightOn");
162+
addControlValue(control, "Button 🛎️");
163+
addControlValue(control, "Button 𓐟");
164+
addControlValue(control, "Button LightOn 🛎️");
165+
addControlValue(control, "Button LightOn 𓐟");
164166
addControlValue(control, "Relay");
165-
addControlValue(control, "Relay LightOn");
166-
addControlValue(control, "Voltage");
167-
addControlValue(control, "Current");
168-
addControlValue(control, "Infrared");
167+
addControlValue(control, "Relay LightOn 🔀");
168+
addControlValue(control, "Voltage️️️ ⚡️");
169+
addControlValue(control, "Current ⚡️");
170+
addControlValue(control, "Infrared ♨️");
169171
addControlValue(control, "DMX in");
170172
addControlValue(control, "Onboard LED");
171173
addControlValue(control, "Onboard Key");
172174
addControlValue(control, "Battery");
173175
addControlValue(control, "Temperature");
174-
addControlValue(control, "Exposed");
175176
addControlValue(control, "SDIO CMD");
176177
addControlValue(control, "SDIO CLK");
177178
addControlValue(control, "SDIO D0");
@@ -181,14 +182,15 @@ class ModuleIO : public Module {
181182
addControlValue(control, "Serial TX");
182183
addControlValue(control, "Serial RX");
183184
addControlValue(control, "Ethernet");
184-
addControlValue(control, "SPI SCK");
185-
addControlValue(control, "SPI MISO");
186-
addControlValue(control, "SPI MOSI");
187-
addControlValue(control, "PHY CS");
188-
addControlValue(control, "PHY IRQ");
185+
addControlValue(control, "SPI SCK 🔗");
186+
addControlValue(control, "SPI MISO 🔗");
187+
addControlValue(control, "SPI MOSI 🔗");
188+
addControlValue(control, "PHY CS 🔗");
189+
addControlValue(control, "PHY IRQ 🔗");
189190
addControlValue(control, "RS-485 TX");
190191
addControlValue(control, "RS-485 RX");
191192
addControlValue(control, "Digital Input");
193+
addControlValue(control, "Exposed");
192194
addControlValue(control, "Reserved");
193195

194196
control = addControl(rows, "index", "number", 1, 32); // max 32 of one type, e.g 32 led pins
@@ -285,7 +287,7 @@ class ModuleIO : public Module {
285287
for (uint8_t gpio : ledPins) pinAssigner.assignPin(gpio, pin_LED);
286288
pinAssigner.assignPin(0, pin_ButtonPush);
287289
pinAssigner.assignPin(45, pin_ButtonPush);
288-
pinAssigner.assignPin(46, pin_Button_LightsOn);
290+
pinAssigner.assignPin(46, pin_Button_Push_LightsOn);
289291
pinAssigner.assignPin(8, pin_Voltage);
290292
pinAssigner.assignPin(9, pin_Current);
291293

@@ -338,7 +340,7 @@ class ModuleIO : public Module {
338340
} else if (boardID == board_QuinLEDDig2Go) {
339341
// dig2go
340342
object["maxPower"] = 10; // USB powered: 2A / 10W
341-
pinAssigner.assignPin(0, pin_Button_LightsOn);
343+
pinAssigner.assignPin(0, pin_Button_Push_LightsOn);
342344
pinAssigner.assignPin(5, pin_Infrared);
343345
pinAssigner.assignPin(16, pin_LED);
344346
pinAssigner.assignPin(12, pin_Relay_LightsOn);
@@ -376,7 +378,7 @@ class ModuleIO : public Module {
376378
pinAssigner.assignPin(16, pin_LED);
377379
// pinAssigner.assignPin(17, pin_LED); // e.g. apa102...
378380

379-
// pinAssigner.assignPin(??, pin_Button_LightsOn); // which pin ?
381+
// pinAssigner.assignPin(??, pin_Button_Push_LightsOn); // which pin ?
380382
pinAssigner.assignPin(19, pin_Relay_LightsOn); // optional
381383

382384
// e.g. for mic
@@ -397,7 +399,7 @@ class ModuleIO : public Module {
397399
else // default
398400
pinAssigner.assignPin(3, pin_LED);
399401

400-
pinAssigner.assignPin(17, pin_Button_LightsOn);
402+
pinAssigner.assignPin(17, pin_Button_Push_LightsOn);
401403
pinAssigner.assignPin(19, pin_Relay_LightsOn);
402404
pinAssigner.assignPin(18, pin_Infrared);
403405

src/MoonLight/Modules/ModuleLightsControl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class ModuleLightsControl : public Module {
8686
EXT_LOGD(ML_TAG, "pinRelayLightsOn found %d", pinRelayLightsOn);
8787
} else
8888
EXT_LOGE(MB_TAG, "gpio %d not valid", pinRelayLightsOn);
89-
} else if (usage == pin_Button_LightsOn) {
89+
} else if (usage == pin_Button_Push_LightsOn) {
9090
if (GPIO_IS_VALID_GPIO(gpio)) {
9191
pinButtonLightsOn = gpio;
9292
pinMode(pinButtonLightsOn, INPUT_PULLUP);

src/MoonLight/Nodes/Drivers/D_ArtnetIn.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ArtNetInDriver : public Node {
2121
uint8_t packetBuffer[1500];
2222

2323
bool ddp = false;
24-
uint8_t view = 1; // Physical is 0, virtual layer 0 (shown as 1) is 1 by default
24+
uint8_t layer = 1; // Physical is 0, virtual layer 0 (shown as 1) is 1 by default
2525
uint16_t port = 6454;
2626
uint16_t universeMin = 0;
2727
uint16_t universeMax = 32767;
@@ -31,7 +31,7 @@ class ArtNetInDriver : public Node {
3131
addControl(port, "port", "number", 0, 65538);
3232
addControl(universeMin, "universeMin", "number", 0, 32767);
3333
addControl(universeMax, "universeMax", "number", 0, 32767);
34-
addControl(view, "view", "select");
34+
addControl(layer, "layer", "select");
3535
addControlValue("Physical layer");
3636
uint8_t i = 1; // start with one
3737
for (VirtualLayer* layer : layerP.layers) {
@@ -129,10 +129,10 @@ class ArtNetInDriver : public Node {
129129
for (int i = 0; i < numPixels; i++) {
130130
int ledIndex = startPixel + i;
131131
if (ledIndex < layerP.lights.header.nrOfLights) {
132-
if (view == 0) {
132+
if (layer == 0) { // Physical layer
133133
memcpy(&layerP.lights.channels[ledIndex * layerP.lights.header.channelsPerLight], &dmxData[i * layerP.lights.header.channelsPerLight], layerP.lights.header.channelsPerLight);
134-
} else {
135-
layerP.layers[view - 1]->setLight(ledIndex, &dmxData[i * layerP.lights.header.channelsPerLight], 0, layerP.lights.header.channelsPerLight);
134+
} else { // Virtual layer
135+
layerP.layers[layer - 1]->setLight(ledIndex, &dmxData[i * layerP.lights.header.channelsPerLight], 0, layerP.lights.header.channelsPerLight);
136136
}
137137
}
138138
}
@@ -159,10 +159,10 @@ class ArtNetInDriver : public Node {
159159
for (int i = 0; i < numPixels; i++) {
160160
int ledIndex = startPixel + i;
161161
if (ledIndex < layerP.lights.header.nrOfLights) {
162-
if (view == 0) {
162+
if (layer == 0) { // Physical layer
163163
memcpy(&layerP.lights.channels[ledIndex * layerP.lights.header.channelsPerLight], &pixelData[i * layerP.lights.header.channelsPerLight], layerP.lights.header.channelsPerLight);
164-
} else {
165-
layerP.layers[view - 1]->setLight(ledIndex, &pixelData[i * layerP.lights.header.channelsPerLight], 0, layerP.lights.header.channelsPerLight);
164+
} else { // Virtual layer
165+
layerP.layers[layer - 1]->setLight(ledIndex, &pixelData[i * layerP.lights.header.channelsPerLight], 0, layerP.lights.header.channelsPerLight);
166166
}
167167
}
168168
}

src/MoonLight/Nodes/Effects/E_WLED.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BouncingBallsEffect : public Node {
3535

3636
if (newAlloc) {
3737
balls = newAlloc;
38-
ballsSize = layer->size.x;
38+
ballsSize = layer->size.y;
3939
} else {
4040
EXT_LOGE(ML_TAG, "(re)allocate balls failed");
4141
}

0 commit comments

Comments
 (0)