Skip to content

Commit c3d48ac

Browse files
committed
UM RGB-Rotary-Encoder: Properly used PinOwner
1 parent 392bda7 commit c3d48ac

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

usermods/rgb-rotary-encoder/rgb-rotary-encoder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RgbRotaryEncoderUsermod : public Usermod
4040
void initRotaryEncoder()
4141
{
4242
PinManagerPinType pins[2] = { { eaIo, false }, { ebIo, false } };
43-
if (!pinManager.allocateMultiplePins(pins, 2, UM_RGBRotaryEncoder)) {
43+
if (!pinManager.allocateMultiplePins(pins, 2, PinOwner::UM_RGBRotaryEncoder)) {
4444
eaIo = -1;
4545
ebIo = -1;
4646
cleanup();
@@ -208,7 +208,7 @@ class RgbRotaryEncoderUsermod : public Usermod
208208
lastKnownBri = bri;
209209

210210
updateLeds();
211-
colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE);
211+
colorUpdated(CALL_MODE_DIRECT_CHANGE);
212212
}
213213

214214
// If the brightness is changed not with the rotary, update the rotary
@@ -323,7 +323,7 @@ class RgbRotaryEncoderUsermod : public Usermod
323323
*/
324324
uint16_t getId()
325325
{
326-
return 0x4711;
326+
return USERMOD_RGB_ROTARY_ENCODER;
327327
}
328328

329329
//More methods can be added in the future, this example will then be extended.

wled00/const.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#define USERMOD_ID_PWM_FAN 19 //Usermod "usermod_PWM_fan.h"
6363
#define USERMOD_ID_BH1750 20 //Usermod "usermod_bh1750.h"
6464
#define USERMOD_ID_SEVEN_SEGMENT_DISPLAY 21 //Usermod "usermod_v2_seven_segment_display.h"
65+
#define USERMOD_RGB_ROTARY_ENCODER 22 //Usermod "rgb-rotary-encoder.h"
6566

6667
//Access point behavior
6768
#define AP_BEHAVIOR_BOOT_NO_CONN 0 //Open AP when no connection after boot

wled00/pin_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ enum struct PinOwner : uint8_t {
3636
DMX = 0x8A, // 'DMX' == hard-coded to IO2
3737
// Use UserMod IDs from const.h here
3838
UM_Unspecified = USERMOD_ID_UNSPECIFIED, // 0x01
39-
UM_RGBRotaryEncoder = USERMOD_ID_UNSPECIFIED, // 0x01 // No define in const.h for this user module -- consider adding?
4039
UM_Example = USERMOD_ID_EXAMPLE, // 0x02 // Usermod "usermod_v2_example.h"
4140
UM_Temperature = USERMOD_ID_TEMPERATURE, // 0x03 // Usermod "usermod_temperature.h"
4241
// #define USERMOD_ID_FIXNETSERVICES // 0x04 // Usermod "usermod_Fix_unreachable_netservices.h" -- Does not allocate pins
@@ -53,6 +52,7 @@ enum struct PinOwner : uint8_t {
5352
// #define USERMOD_ID_RTC // 0x0F // Usermod "usermod_rtc.h" -- Uses "standard" I2C pins ... TODO -- enable shared I2C bus use
5453
// #define USERMOD_ID_ELEKSTUBE_IPS // 0x10 // Usermod "usermod_elekstube_ips.h" -- Uses quite a few pins ... see Hardware.h and User_Setup.h
5554
// #define USERMOD_ID_SN_PHOTORESISTOR // 0x11 // Usermod "usermod_sn_photoresistor.h" -- Uses hard-coded pin (PHOTORESISTOR_PIN == A0), but could be easily updated to use pinManager
55+
UM_RGBRotaryEncoder = USERMOD_RGB_ROTARY_ENCODER // 0x16 // Usermod "rgb-rotary-encoder.h"
5656
};
5757
static_assert(0u == static_cast<uint8_t>(PinOwner::None), "PinOwner::None must be zero, so default array initialization works as expected");
5858

0 commit comments

Comments
 (0)