still incomplete makeDevice function
This commit is contained in:
@ -150,20 +150,27 @@ static bool setFrontendThresholdCmd(uint8_t argc, char **args) {
|
|||||||
0, 1023);
|
0, 1023);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool addDeviceCmd(uint8_t argc, char **args) {
|
static bool makeDevice(uint8_t argc, char **args, t_deviceBlock *deviceBlock) {
|
||||||
if (argc != 8) {
|
if (argc != 8) {
|
||||||
sendString("wrong number of arguments\n\r");
|
sendString("wrong number of arguments\n\r");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *deviceName = args[1];
|
char *deviceName = args[1];
|
||||||
|
if (strlen(deviceName) >= sizeof(deviceBlock->deviceName)) {
|
||||||
|
sendString("devicename too long\n\r");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
strcpy(deviceBlock->deviceName, deviceName);
|
||||||
|
|
||||||
long int rawAddress = strtol(args[2], NULL, 10);
|
long int rawAddress = strtol(args[2], NULL, 10);
|
||||||
if (rawAddress < 1 || rawAddress > 254) {
|
if (rawAddress < 1 || rawAddress > 254) {
|
||||||
sendString("illegal address\n\r");
|
sendString("illegal address\n\r");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint8_t address = (uint8_t)rawAddress;
|
deviceBlock->address = (uint8_t)rawAddress;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user