diff --git a/main.cpp b/main.cpp index 466d71d..86f403d 100644 --- a/main.cpp +++ b/main.cpp @@ -113,7 +113,7 @@ void writeItemState(Serial* serial, Item* relay, uint8_t number) void itemDispatch(SVector* items, Pwm16b* auxPwm, char* token, Serial* serial) { - if( strcmp(token, "add") == 0 ) + if(strcmp(token, "add") == 0) { token = strtok(NULL, " \n"); uint16_t id = strtol(token, nullptr, 2 ); @@ -125,15 +125,17 @@ void itemDispatch(SVector* items, Pwm16b* auxPwm, char* token, Item item; item.id = id; item.type = type; - if( token != NULL ) item.setName(token); + if( token != NULL ) + item.setName(token); items->push_back(item); writeItemState(serial, &items->back(), items->count()-1); } - else if(items->remainingCapacity() == 0) serial->write_p(PSTR("Relay storage full.\n")); - else serial->write_p( - PSTR("Usage: item add [id] [type] [name]\n [id] being a 16bit binary nummber and [name] an optional string\n")); + else if(items->remainingCapacity() == 0) + serial->write_p(PSTR("Relay storage full.\n")); + else + serial->write_p(PSTR("Usage: item add [id] [type] [name]\n [id] being a 16bit binary nummber and [name] an optional string\n")); } - else if( strcmp(token, "delete") == 0 ) + else if(strcmp(token, "delete") == 0) { token = strtok(NULL, " \n"); if(items->count() > 0) @@ -145,10 +147,10 @@ void itemDispatch(SVector* items, Pwm16b* auxPwm, char* token, items->erase(index); } } - else if( strcmp(token, "on") == 0 ) + else if(strcmp(token, "on") == 0) { char* token = strtok(NULL, " \n"); - if( token != NULL) + if(token != NULL) { uint8_t selected = strtol(token, nullptr, 10); if (selected < items->count()) @@ -163,7 +165,7 @@ void itemDispatch(SVector* items, Pwm16b* auxPwm, char* token, } else serial->write_p(PSTR("Usage: item on [nn]\n")); } - else if( strcmp(token, "off") == 0 ) + else if(strcmp(token, "off") == 0) { char* token = strtok(NULL, " \n"); if( token != NULL) @@ -181,7 +183,7 @@ void itemDispatch(SVector* items, Pwm16b* auxPwm, char* token, } else serial->write_p(PSTR("Usage: item off [nn]\n")); } - else if( strcmp(token, "resend") == 0 ) + else if(strcmp(token, "resend") == 0) { char* token = strtok(NULL, " \n"); serial->write_p(PSTR("Resend every 30 min is ")); @@ -455,8 +457,7 @@ int main() W433DataReciver reciver(&PINC, PC0, &TCNT1, &TIFR1, &sensorPacketRecived, reinterpret_cast(&serial), &reciverError); W433DataTransmitter transmitter(&PORTB, PB5); - UvosItem::transmitter=&transmitter; - + UvosItem::transmitter = &transmitter; serial.write_p(PSTR("RGBController v1.5 starting\n")); diff --git a/uvositem.cpp b/uvositem.cpp index 7763241..83c6127 100644 --- a/uvositem.cpp +++ b/uvositem.cpp @@ -15,7 +15,8 @@ UvosItem::UvosItem(const Item& item) void UvosItem::setValue(const uint8_t value) { const uint8_t paket[4] = {id >> 8, id & 0x00FF, 0, value}; - if(transmitter)transmitter->send(paket, 4); + if(transmitter) + transmitter->send(paket, 4); } void UvosItem::resend() diff --git a/writepin.h b/writepin.h index 20ea504..b8bd285 100644 --- a/writepin.h +++ b/writepin.h @@ -2,7 +2,8 @@ #define WRITEPIN_H #include - +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" inline void writePin(volatile unsigned char *port, const unsigned char pin, const bool state) //waste 2 cycles { *port &= ~(1 << pin); @@ -24,6 +25,6 @@ inline bool readPin( volatile unsigned char *inPort, const unsigned char pin) { return (bool) (*inPort & (1 << pin)); } - +#pragma GCC diagnostic pop #endif