mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-08 22:56:05 +00:00
rest interface for pins now also shows pin states, i will need it for pin doctor
This commit is contained in:
@ -645,32 +645,33 @@ static int http_rest_get_pins(http_request_t* request) {
|
||||
poststr(request, "{\"rolenames\":[");
|
||||
for (i = 0; i < IOR_Total_Options; i++) {
|
||||
if (i) {
|
||||
hprintf255(request, ",\"%s\"", htmlPinRoleNames[i]);
|
||||
}
|
||||
else {
|
||||
hprintf255(request, "\"%s\"", htmlPinRoleNames[i]);
|
||||
hprintf255(request, ",");
|
||||
}
|
||||
hprintf255(request, "\"%s\"", htmlPinRoleNames[i]);
|
||||
}
|
||||
poststr(request, "],\"roles\":[");
|
||||
|
||||
for (i = 0; i < PLATFORM_GPIO_MAX; i++) {
|
||||
if (i) {
|
||||
hprintf255(request, ",%d", g_cfg.pins.roles[i]);
|
||||
}
|
||||
else {
|
||||
hprintf255(request, "%d", g_cfg.pins.roles[i]);
|
||||
hprintf255(request, ",");
|
||||
}
|
||||
hprintf255(request, "%d", g_cfg.pins.roles[i]);
|
||||
}
|
||||
// TODO: maybe we should cull futher channels that are not used?
|
||||
// I support many channels because I plan to use 16x relays module with I2C MCP23017 driver
|
||||
poststr(request, "],\"channels\":[");
|
||||
for (i = 0; i < CHANNEL_MAX; i++) {
|
||||
if (i) {
|
||||
hprintf255(request, ",%d", g_cfg.pins.channels[i]);
|
||||
hprintf255(request, ",");
|
||||
}
|
||||
else {
|
||||
hprintf255(request, "%d", g_cfg.pins.channels[i]);
|
||||
hprintf255(request, "%d", g_cfg.pins.channels[i]);
|
||||
}
|
||||
poststr(request, "],\"states\":[");
|
||||
for (i = 0; i < CHANNEL_MAX; i++) {
|
||||
if (i) {
|
||||
hprintf255(request, ",");
|
||||
}
|
||||
hprintf255(request, "%d", CHANNEL_Get(g_cfg.pins.channels[i]));
|
||||
}
|
||||
poststr(request, "]}");
|
||||
poststr(request, NULL);
|
||||
|
||||
Reference in New Issue
Block a user