addDevice
This commit is contained in:
parent
39967403d9
commit
d32eb45bea
@ -164,7 +164,7 @@ static bool makeDevice(uint8_t argOffset, uint8_t argc, char **args, t_deviceBlo
|
||||
sendString("address: between 1 and 254\n\r");
|
||||
sendString("period: in seconds, between 0 (disabled) and 86400 (1 day)\n\r");
|
||||
sendString("fields: between -1 (not considered) and 254\n\r");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if (strlen(deviceName) >= sizeof(deviceBlock->deviceName)) {
|
||||
sendString("devicename too long\n\r");
|
||||
@ -201,12 +201,13 @@ static bool makeDevice(uint8_t argOffset, uint8_t argc, char **args, t_deviceBlo
|
||||
static bool addDeviceCmd(uint8_t argc, char **args) {
|
||||
t_deviceBlock deviceBlock;
|
||||
bool retCode = makeDevice(0, argc, args, &deviceBlock);
|
||||
|
||||
sendString("New device would be:\n\r");
|
||||
sendFormatString(" Name: %s, Address: %d, Period: %d\n\r",
|
||||
deviceBlock.deviceName, deviceBlock.address, deviceBlock.period);
|
||||
for (uint8_t i = 0; i < MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS; i++) {
|
||||
sendFormatString(" Considered field: %d\n\r", deviceBlock.consideredField[i]);
|
||||
if (retCode) {
|
||||
sendString("New device would be:\n\r");
|
||||
sendFormatString(" Name: %s, Address: %d, Period: %d\n\r",
|
||||
deviceBlock.deviceName, deviceBlock.address, deviceBlock.period);
|
||||
for (uint8_t i = 0; i < MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS; i++) {
|
||||
sendFormatString(" Considered field: %d\n\r", deviceBlock.consideredField[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return retCode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user