fix item name printing
This commit is contained in:
@ -31,7 +31,7 @@ private:
|
|||||||
static constexpr uint16_t LARGE_TIME_TOLERANCE = LARGE_TIME*0.30;
|
static constexpr uint16_t LARGE_TIME_TOLERANCE = LARGE_TIME*0.30;
|
||||||
static constexpr uint8_t SMALL_TIME_TOLERANCE = SMALL_TIME*0.30;
|
static constexpr uint8_t SMALL_TIME_TOLERANCE = SMALL_TIME*0.30;
|
||||||
static constexpr uint16_t DISCARD_TIME = SMALL_TIME*0.6;
|
static constexpr uint16_t DISCARD_TIME = SMALL_TIME*0.6;
|
||||||
static constexpr uint16_t TICKS_PER_US = (F_CPU) / (1000000*CLOCK_DEVIDER) ;
|
static constexpr uint16_t TICKS_PER_US = (F_CPU) / (1000000*CLOCK_DEVIDER);
|
||||||
static constexpr uint8_t signature = 0xA5;
|
static constexpr uint8_t signature = 0xA5;
|
||||||
|
|
||||||
static constexpr int8_t polarity = 1;
|
static constexpr int8_t polarity = 1;
|
||||||
|
2
item.cpp
2
item.cpp
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
void Item::setName(const char * const nameN)
|
void Item::setName(const char * const nameN)
|
||||||
{
|
{
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(nameN);
|
||||||
if(len < MAX_NAME_LENGTH)memcpy(name, nameN, len+1);
|
if(len < MAX_NAME_LENGTH)memcpy(name, nameN, len+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
main.cpp
5
main.cpp
@ -121,8 +121,7 @@ void itemDispatch(SVector<Item, MAX_ITEMS>* items, Pwm16b* auxPwm, char* token,
|
|||||||
uint8_t type = strtol(token, nullptr, 10 );
|
uint8_t type = strtol(token, nullptr, 10 );
|
||||||
if(id != 0 && (type == 0 || type == 1) && items->remainingCapacity() > 0)
|
if(id != 0 && (type == 0 || type == 1) && items->remainingCapacity() > 0)
|
||||||
{
|
{
|
||||||
id = id << 4;
|
token = strtok(NULL, "\n\0");
|
||||||
token = strtok(NULL, "\0");
|
|
||||||
Item item;
|
Item item;
|
||||||
item.id = id;
|
item.id = id;
|
||||||
item.type = type;
|
item.type = type;
|
||||||
@ -153,6 +152,7 @@ void itemDispatch(SVector<Item, MAX_ITEMS>* items, Pwm16b* auxPwm, char* token,
|
|||||||
uint8_t selected = strtol(token, nullptr, 10);
|
uint8_t selected = strtol(token, nullptr, 10);
|
||||||
if (selected < items->count())
|
if (selected < items->count())
|
||||||
{
|
{
|
||||||
|
items->at(selected).lastValue = true;
|
||||||
if(items->at(selected).type == 0)WirelessRelay(items->at(selected)).setValue(true);
|
if(items->at(selected).type == 0)WirelessRelay(items->at(selected)).setValue(true);
|
||||||
else UvosItem(items->at(selected)).setValue(true);
|
else UvosItem(items->at(selected)).setValue(true);
|
||||||
|
|
||||||
@ -170,6 +170,7 @@ void itemDispatch(SVector<Item, MAX_ITEMS>* items, Pwm16b* auxPwm, char* token,
|
|||||||
uint8_t selected = strtol(token, nullptr, 10);
|
uint8_t selected = strtol(token, nullptr, 10);
|
||||||
if (selected < items->count())
|
if (selected < items->count())
|
||||||
{
|
{
|
||||||
|
items->at(selected).lastValue = false;
|
||||||
if(items->at(selected).type == 0)WirelessRelay(items->at(selected)).setValue(false);
|
if(items->at(selected).type == 0)WirelessRelay(items->at(selected)).setValue(false);
|
||||||
else UvosItem(items->at(selected)).setValue(false);
|
else UvosItem(items->at(selected)).setValue(false);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user