@@ -78,9 +78,9 @@ void setup()
7878 pinMode (BLUE_PIN, OUTPUT);
7979
8080 // 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 ));
8484
8585 // Get value from eeprom and write to output
8686 analogWrite (RED_PIN, 255 * gw.loadState (RED_PIN) / 100 );
@@ -105,7 +105,7 @@ void setup()
105105 gw.send ( BlueStatus.set (gw.loadState (BLUE_PIN)), false );
106106
107107 // 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 ));
109109 isShow=gw.loadState (0 );
110110
111111 // Send RGB show state to controler (request ack back: true/false)
@@ -189,7 +189,7 @@ void incomingMessage(const MyMessage &message)
189189 // Save old value to eeprom if it'was not zero
190190 if ( gw.loadState (message.sensor ) != 0 )
191191 {
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 ));
193193 }
194194 // Save new value to eeprom
195195 gw.saveState (message.sensor , 0 );
@@ -212,7 +212,7 @@ void incomingMessage(const MyMessage &message)
212212 {
213213 uint8_t incomingDimmerStatus = message.getByte ();
214214 // limits range of sensor values to between 0 and 100
215- incomingDimmerStatus = constrain (incomingDimmerStatus, 0 , 100 );
215+ incomingDimmerStatus = constrain (( int8_t ) incomingDimmerStatus, 0 , 100 );
216216 // Change Dimmer level
217217 analogWrite (message.sensor , 255 * incomingDimmerStatus / 100 );
218218 // Save value to eeprom
0 commit comments