fix item name printing

This commit is contained in:
uvos 2022-04-12 00:35:42 +02:00
parent 0883a1c9d5
commit 00ca1d6f03
3 changed files with 5 additions and 4 deletions

View File

@ -31,7 +31,7 @@ private:
static constexpr uint16_t LARGE_TIME_TOLERANCE = LARGE_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 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 int8_t polarity = 1;

View File

@ -3,7 +3,7 @@
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);
}

View File

@ -121,8 +121,7 @@ void itemDispatch(SVector<Item, MAX_ITEMS>* items, Pwm16b* auxPwm, char* token,
uint8_t type = strtol(token, nullptr, 10 );
if(id != 0 && (type == 0 || type == 1) && items->remainingCapacity() > 0)
{
id = id << 4;
token = strtok(NULL, "\0");
token = strtok(NULL, "\n\0");
Item item;
item.id = id;
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);
if (selected < items->count())
{
items->at(selected).lastValue = true;
if(items->at(selected).type == 0)WirelessRelay(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);
if (selected < items->count())
{
items->at(selected).lastValue = false;
if(items->at(selected).type == 0)WirelessRelay(items->at(selected)).setValue(false);
else UvosItem(items->at(selected)).setValue(false);