@@ -78,9 +78,9 @@ void setup()
78
78
pinMode (BLUE_PIN, OUTPUT);
79
79
80
80
// Correct saved RGB value for first start
81
- gw.saveState (RED_PIN, constrain (gw.loadState (RED_PIN), 0 , 100 ));
82
- gw.saveState (GREEN_PIN, constrain (gw.loadState (GREEN_PIN), 0 , 100 ));
83
- gw.saveState (BLUE_PIN, constrain (gw.loadState (BLUE_PIN), 0 , 100 ));
81
+ gw.saveState (RED_PIN, constrain (( int8_t ) gw.loadState (RED_PIN), 0 , 100 ));
82
+ gw.saveState (GREEN_PIN, constrain (( int8_t ) gw.loadState (GREEN_PIN), 0 , 100 ));
83
+ gw.saveState (BLUE_PIN, constrain (( int8_t ) gw.loadState (BLUE_PIN), 0 , 100 ));
84
84
85
85
// Get value from eeprom and write to output
86
86
analogWrite (RED_PIN, 255 * gw.loadState (RED_PIN) / 100 );
@@ -105,7 +105,7 @@ void setup()
105
105
gw.send ( BlueStatus.set (gw.loadState (BLUE_PIN)), false );
106
106
107
107
// Correct RGB show state for first start and load it (set to 'On' at first start)
108
- gw.saveState (0 , constrain (gw.loadState (0 ), 0 , 1 ));
108
+ gw.saveState (0 , constrain (( int8_t ) gw.loadState (0 ), 0 , 1 ));
109
109
isShow=gw.loadState (0 );
110
110
111
111
// Send RGB show state to controler (request ack back: true/false)
@@ -189,7 +189,7 @@ void incomingMessage(const MyMessage &message)
189
189
// Save old value to eeprom if it'was not zero
190
190
if ( gw.loadState (message.sensor ) != 0 )
191
191
{
192
- gw.saveState (10 *message.sensor , constrain (gw.loadState (message.sensor ), 0 , 100 ));
192
+ gw.saveState (10 *message.sensor , constrain (( int8_t ) gw.loadState (message.sensor ), 0 , 100 ));
193
193
}
194
194
// Save new value to eeprom
195
195
gw.saveState (message.sensor , 0 );
@@ -212,7 +212,7 @@ void incomingMessage(const MyMessage &message)
212
212
{
213
213
uint8_t incomingDimmerStatus = message.getByte ();
214
214
// limits range of sensor values to between 0 and 100
215
- incomingDimmerStatus = constrain (incomingDimmerStatus, 0 , 100 );
215
+ incomingDimmerStatus = constrain (( int8_t ) incomingDimmerStatus, 0 , 100 );
216
216
// Change Dimmer level
217
217
analogWrite (message.sensor , 255 * incomingDimmerStatus / 100 );
218
218
// Save value to eeprom
0 commit comments