Add channel_get_total()
This commit is contained in:
@ -21,8 +21,8 @@ static bool rpc_args_to_idx_and_gpio(struct mg_rpc_request_info *ri, struct mg_s
|
||||
return false;
|
||||
}
|
||||
|
||||
if (idx<0 || idx>2) {
|
||||
mg_rpc_send_errorf(ri, 400, "idx must be 0, 1, 2");
|
||||
if (idx<0 || idx>=channel_get_total()) {
|
||||
mg_rpc_send_errorf(ri, 400, "idx must be between 0 and %d", channel_get_total()-1);
|
||||
ri = NULL;
|
||||
return false;
|
||||
}
|
||||
@ -95,8 +95,8 @@ static void rpc_channel_set_handler(struct mg_rpc_request_info *ri, void *cb_arg
|
||||
return;
|
||||
}
|
||||
|
||||
if (idx<0 || idx>2) {
|
||||
mg_rpc_send_errorf(ri, 400, "idx must be 0, 1, 2");
|
||||
if (idx<0 || idx>=channel_get_total()) {
|
||||
mg_rpc_send_errorf(ri, 400, "idx must be between 0 and %d", channel_get_total()-1);
|
||||
ri = NULL;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user