Допилена функция обнолвения портов
This commit is contained in:
parent
dbf789d209
commit
19e6066a57
@ -97,7 +97,7 @@ function refresh_ports() {
|
||||
const ports_array = response;
|
||||
|
||||
// Проверка длины массива
|
||||
if (ports_array.length > 0) {
|
||||
if (ports_array.ports.length > 0) {
|
||||
port_selector.innerHTML = '';
|
||||
} else {
|
||||
alert('Отсутсвуют подключённые устройства!');
|
||||
|
11
src/config.h
Normal file
11
src/config.h
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* AUTHOR: Alexander Popov <iiiypuk {at} fastmail.fm>
|
||||
* DESC: ...
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H_
|
||||
#define CONFIG_H_
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#endif
|
11
src/main.c
11
src/main.c
@ -2,6 +2,8 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "webui.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "html.h"
|
||||
#include "ui.h"
|
||||
#include "device.h"
|
||||
@ -12,13 +14,10 @@ int main(int argc, char const *argv[]) {
|
||||
int app_window = webui_new_window();
|
||||
|
||||
html_document[html_document_len] = '\0';
|
||||
// html_document[html_document_len + 1] = '\0';
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "icanthink") == 0) {
|
||||
}
|
||||
else {
|
||||
webui_set_kiosk(app_window, true);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
webui_set_kiosk(app_window, true);
|
||||
#endif
|
||||
|
||||
webui_bind(app_window, "close_app", close_app);
|
||||
webui_bind(app_window, "webui_refresh_ports", refresh_devices);
|
||||
|
8
src/ui.c
8
src/ui.c
@ -12,9 +12,13 @@ void close_app(webui_event_t* e) {
|
||||
}
|
||||
|
||||
void refresh_devices(webui_event_t* e) {
|
||||
printf("ololo\n");
|
||||
const char *available_ports = json_dumps(get_serial_ports(), 0);
|
||||
|
||||
webui_return_string(e, json_dumps(get_serial_ports(), 0));
|
||||
#ifdef DEBUG
|
||||
printf("Доступные порты:\n%s\n", available_ports);
|
||||
#endif
|
||||
|
||||
webui_return_string(e, available_ports);
|
||||
}
|
||||
|
||||
void connect_device(webui_event_t* e) {
|
||||
|
Loading…
Reference in New Issue
Block a user