Skip to content

Commit 2b618e2

Browse files
removed var
1 parent e45e6b4 commit 2b618e2

File tree

3 files changed

+47
-73
lines changed

3 files changed

+47
-73
lines changed

evil_portal_app_i.h

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct Evil_PortalApp {
4343
bool sent_ap;
4444
bool sent_html;
4545
int BAUDRATE;
46-
int TERMINAL_MODE; // 1=AT mode, 0=other mode
4746

4847
uint8_t *index_html;
4948
uint8_t *ap_name;

evil_portal_uart.c

-19
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#include "evil_portal_uart.h"
33
#include "helpers/evil_portal_storage.h"
44

5-
// #define UART_CH (FuriHalUartIdUSART1)
6-
// #define BAUDRATE (115200)
7-
85
struct Evil_PortalUart {
96
Evil_PortalApp *app;
107
FuriThread *rx_thread;
@@ -82,24 +79,8 @@ static int32_t uart_worker(void *context) {
8279
uart->app->has_command_queue = false;
8380
uart->app->command_queue[0] = "";
8481
}
85-
86-
// if(0 == strncmp("ack", (char *)uart->rx_buf, strlen("ack"))) {
87-
88-
// } else {
89-
// uart->app->command_index = 0;
90-
// uart->app->has_command_queue = false;
91-
// uart->app->command_queue[0] = "";
92-
// }
93-
// }
9482
}
9583

96-
// rx_buf has response
97-
// wait for ack
98-
// if response is ack
99-
// check for commands
100-
// if has commands
101-
// send next command
102-
10384
strcat(uart->app->portal_logs, (char *)uart->rx_buf);
10485
if (strlen(uart->app->portal_logs) > 4000) {
10586
write_logs(uart->app->portal_logs);

scenes/evil_portal_scene_console_output.c

+47-53
Original file line numberDiff line numberDiff line change
@@ -102,63 +102,57 @@ void evil_portal_scene_console_output_on_enter(void *context) {
102102
// Send command with CR+LF or newline '\n'
103103
// it is sent here
104104
if (app->is_command && app->selected_tx_string) {
105-
if (app->TERMINAL_MODE == 1) {
105+
106+
// handle special commands here
107+
if (0 == strncmp("sethtml", app->selected_tx_string, strlen("sethtml"))) {
108+
evil_portal_read_index_html(context);
109+
110+
char *data = malloc(
111+
(size_t)(strlen((char *)app->index_html) + strlen("sethtml=")));
112+
strcat(data, "sethtml=");
113+
strcat(data, (char *)app->index_html);
114+
115+
evil_portal_uart_tx((uint8_t *)(data), strlen(data));
116+
evil_portal_uart_tx((uint8_t *)("\n"), 1);
117+
118+
app->sent_html = true;
119+
120+
free(data);
121+
free(app->index_html);
122+
123+
evil_portal_read_ap_name(context);
124+
} else if (0 ==
125+
strncmp("setap", app->selected_tx_string, strlen("setap"))) {
126+
127+
evil_portal_read_ap_name(context);
128+
129+
char *data =
130+
malloc((size_t)(strlen((char *)app->ap_name) + strlen("setap=")));
131+
strcat(data, "setap=");
132+
strcat(data, (char *)app->ap_name);
133+
134+
evil_portal_uart_tx((uint8_t *)(data), strlen(data));
135+
evil_portal_uart_tx((uint8_t *)("\n"), 1);
136+
137+
app->sent_ap = true;
138+
139+
free(data);
140+
free(app->ap_name);
141+
} else if (0 ==
142+
strncmp("reset", app->selected_tx_string, strlen("reset"))) {
143+
app->sent_html = false;
144+
app->sent_ap = false;
106145
evil_portal_uart_tx((uint8_t *)(app->selected_tx_string),
107146
strlen(app->selected_tx_string));
108-
evil_portal_uart_tx((uint8_t *)("\r\n"), 2);
147+
evil_portal_uart_tx((uint8_t *)("\n"), 1);
148+
} else if (0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
149+
// nothing to do
109150
} else {
110-
// handle special commands here
111-
if (0 == strncmp("sethtml", app->selected_tx_string, strlen("sethtml"))) {
112-
evil_portal_read_index_html(context);
113-
114-
char *data = malloc(
115-
(size_t)(strlen((char *)app->index_html) + strlen("sethtml=")));
116-
strcat(data, "sethtml=");
117-
strcat(data, (char *)app->index_html);
118-
119-
evil_portal_uart_tx((uint8_t *)(data), strlen(data));
120-
evil_portal_uart_tx((uint8_t *)("\n"), 1);
121-
122-
app->sent_html = true;
123-
124-
free(data);
125-
free(app->index_html);
126-
127-
evil_portal_read_ap_name(context);
128-
} else if (0 ==
129-
strncmp("setap", app->selected_tx_string, strlen("setap"))) {
130-
131-
evil_portal_read_ap_name(context);
132-
133-
char *data =
134-
malloc((size_t)(strlen((char *)app->ap_name) + strlen("setap=")));
135-
strcat(data, "setap=");
136-
strcat(data, (char *)app->ap_name);
137-
138-
evil_portal_uart_tx((uint8_t *)(data), strlen(data));
139-
evil_portal_uart_tx((uint8_t *)("\n"), 1);
140-
141-
app->sent_ap = true;
142-
143-
free(data);
144-
free(app->ap_name);
145-
} else if (0 ==
146-
strncmp("reset", app->selected_tx_string, strlen("reset"))) {
147-
app->sent_html = false;
148-
app->sent_ap = false;
149-
evil_portal_uart_tx((uint8_t *)(app->selected_tx_string),
150-
strlen(app->selected_tx_string));
151-
evil_portal_uart_tx((uint8_t *)("\n"), 1);
152-
} else if (0 ==
153-
strncmp("help", app->selected_tx_string, strlen("help"))) {
154-
// do nothing?
155-
} else {
156-
evil_portal_uart_tx((uint8_t *)(app->selected_tx_string),
157-
strlen(app->selected_tx_string));
158-
evil_portal_uart_tx((uint8_t *)("\n"), 1);
159-
}
151+
evil_portal_uart_tx((uint8_t *)(app->selected_tx_string),
152+
strlen(app->selected_tx_string));
153+
evil_portal_uart_tx((uint8_t *)("\n"), 1);
160154
}
161-
}
155+
}
162156
}
163157

164158
bool evil_portal_scene_console_output_on_event(void *context,

0 commit comments

Comments
 (0)