mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 02:08:08 +08:00
Fix config reporting
This commit is contained in:
parent
2c2c7f6894
commit
eff54827b2
File diff suppressed because one or more lines are too long
@ -435,7 +435,7 @@ function DeviceControlPanel({device, config, setConfig, publishFn, connected}) {
|
||||
};
|
||||
|
||||
const Pin = i => html`
|
||||
<div class="inline-block mr-8 my-1 bg-gray-100 rounded px-2 w-32 py-1">
|
||||
<div class="inline-block my-1 bg-gray-100 rounded px-1 py-1">
|
||||
<div class="flex align-center justify-between">
|
||||
<span class="${LabelClass}">Pin ${config.pin_map[i]}<//>
|
||||
<${Toggle} onclick=${ev => onclick(i)}
|
||||
@ -449,7 +449,7 @@ function DeviceControlPanel({device, config, setConfig, publishFn, connected}) {
|
||||
<div class="px-4 py-2 flex justify-between items-center font-light uppercase text-gray-600 rounded">
|
||||
<div class="flex gap-2 items-center">Pin Control Panel<//>
|
||||
<//>
|
||||
<div class="p-4 gap-2">
|
||||
<div class="p-4 grid grid-cols-2 lg:grid-cols-3 gap-2">
|
||||
${(config.pin_map || []).map((_, i) => Pin(i))}
|
||||
<div><//>
|
||||
<//>
|
||||
|
@ -62,9 +62,18 @@ static size_t print_fw_status(void (*out)(char, void *), void *ptr,
|
||||
MG_ESC("timestamp"), mg_ota_timestamp(fw));
|
||||
}
|
||||
|
||||
static size_t print_ints(void (*out)(char, void *), void *ptr, va_list *ap) {
|
||||
int *array = va_arg(*ap, int *);
|
||||
size_t i, len = 0, num_elems = va_arg(*ap, size_t);
|
||||
static size_t print_shorts(void (*out)(char, void *), void *ptr, va_list *ap) {
|
||||
uint16_t *array = va_arg(*ap, uint16_t *);
|
||||
int i, len = 0, num_elems = va_arg(*ap, int);
|
||||
for (i = 0; i < num_elems; i++) {
|
||||
len += mg_xprintf(out, ptr, "%s%hu", i ? "," : "", array[i]);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
static size_t print_bools(void (*out)(char, void *), void *ptr, va_list *ap) {
|
||||
bool *array = va_arg(*ap, bool *);
|
||||
int i, len = 0, num_elems = va_arg(*ap, int);
|
||||
for (i = 0; i < num_elems; i++) {
|
||||
len += mg_xprintf(out, ptr, "%s%d", i ? "," : "", array[i]);
|
||||
}
|
||||
@ -83,9 +92,9 @@ static void publish_status(struct mg_connection *c) {
|
||||
MG_ESC("status"), MG_ESC("online"), //
|
||||
MG_ESC(("log_level")), s_device_config.log_level, //
|
||||
MG_ESC(("pin_count")), s_device_config.pin_count, //
|
||||
MG_ESC(("pin_map")), print_ints, s_device_config.pin_map,
|
||||
MG_ESC(("pin_map")), print_shorts, s_device_config.pin_map,
|
||||
s_device_config.pin_count, //
|
||||
MG_ESC(("pin_state")), print_ints, s_device_config.pin_state,
|
||||
MG_ESC(("pin_state")), print_bools, s_device_config.pin_state,
|
||||
s_device_config.pin_count, //
|
||||
MG_ESC(("crnt_fw")), print_fw_status, MG_FIRMWARE_CURRENT, //
|
||||
MG_ESC(("prev_fw")), print_fw_status, MG_FIRMWARE_PREVIOUS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user