diff --git a/MQTT.cpp b/MQTT.cpp index 4c80c38..59095ee 100644 --- a/MQTT.cpp +++ b/MQTT.cpp @@ -35,7 +35,7 @@ void MQTTClass::receive(const char *topic, byte*payload, uint32_t length) { //Serial.println(); // We need to start at the last slash in the data - uint16_t ndx = strlen(topic) - 1; + int16_t ndx = strlen(topic) - 1; // ------------------+ // shades/1/target/set while(ndx >= 0 && topic[ndx] != '/') ndx--; // Back off the set command diff --git a/Somfy.cpp b/Somfy.cpp index 6341876..4989138 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -1831,7 +1831,7 @@ static somfy_rx_queue_t rx_queue; bool somfy_tx_queue_t::pop(somfy_tx_t *tx) { // Read the oldest index. - for(uint8_t i = MAX_TX_BUFFER - 1; i >= 0; i--) { + for(int8_t i = MAX_TX_BUFFER - 1; i >= 0; i--) { if(this->index[i] < MAX_TX_BUFFER) { uint8_t ndx = this->index[i]; memcpy(tx, &this->items[ndx], sizeof(somfy_tx_t)); @@ -1881,7 +1881,7 @@ void somfy_rx_queue_t::init() { bool somfy_rx_queue_t::pop(somfy_rx_t *rx) { // Read off the data from the oldest index. //Serial.println("Popping RX Queue"); - for(uint8_t i = MAX_RX_BUFFER - 1; i >= 0; i--) { + for(int8_t i = MAX_RX_BUFFER - 1; i >= 0; i--) { if(this->index[i] < MAX_RX_BUFFER) { uint8_t ndx = this->index[i]; memcpy(rx, &this->items[this->index[i]], sizeof(somfy_rx_t)); diff --git a/Web.cpp b/Web.cpp index 8e5b78f..6837cbf 100644 --- a/Web.cpp +++ b/Web.cpp @@ -165,7 +165,7 @@ void Web::begin() { Serial.print("Received:"); Serial.println(apiServer.arg("plain")); // Send the command to the shade. - if(target >= 0 && target <= 100) + if(target <= 100) shade->moveToTarget(target); else shade->sendCommand(command, repeat); @@ -686,7 +686,7 @@ void Web::begin() { Serial.print("Received:"); Serial.println(server.arg("plain")); // Send the command to the shade. - if(target >= 0 && target <= 100) + if(target <= 100) shade->moveToTiltTarget(target); else shade->sendTiltCommand(command); @@ -753,7 +753,7 @@ void Web::begin() { Serial.print("Received:"); Serial.println(server.arg("plain")); // Send the command to the shade. - if(target >= 0 && target <= 100) + if(target <= 100) shade->moveToTarget(target); else shade->sendCommand(command, repeat);