addDevice completed
This commit is contained in:
@ -222,6 +222,23 @@ static bool addDeviceCmd(uint8_t argc, char **args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t index = getConfig()->numOfDeviceBlocks;
|
||||||
|
for (uint8_t i = 0; i < getConfig()->numOfDeviceBlocks; i++) {
|
||||||
|
t_deviceBlock tmpDeviceBlock;
|
||||||
|
eepromReadDeviceBlock(i, &tmpDeviceBlock);
|
||||||
|
if (tmpDeviceBlock.period == -1) {
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eepromWriteDeviceBlock(index, &deviceBlock);
|
||||||
|
if (index == getConfig()->numOfDeviceBlocks) {
|
||||||
|
t_configBlock configBlock;
|
||||||
|
eepromReadConfigBlock(&configBlock);
|
||||||
|
configBlock.numOfDeviceBlocks += 1;
|
||||||
|
eepromWriteConfigBlock(&configBlock);
|
||||||
|
}
|
||||||
|
|
||||||
return retCode;
|
return retCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user