mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 07:38:36 -07:00
XFW esp bin coming soon --nobuild
This commit is contained in:
@@ -101,12 +101,10 @@ static void show_access_point(Canvas* canvas, Context* context) {
|
|||||||
|
|
||||||
AccessPoint ap = ctx->active_access_point;
|
AccessPoint ap = ctx->active_access_point;
|
||||||
|
|
||||||
// canvas_draw_str_aligned(canvas, 3, 25, AlignLeft, AlignBottom, ap.ssid);
|
|
||||||
canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignBottom, ap.ssid);
|
canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignBottom, ap.ssid);
|
||||||
|
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontSecondary);
|
||||||
|
|
||||||
// canvas_draw_str_aligned(canvas, 43, 12, AlignLeft, AlignBottom, ap.bssid);
|
|
||||||
canvas_draw_str_aligned(
|
canvas_draw_str_aligned(
|
||||||
canvas, 38 + (ctx->access_points_count > 99 ? 5 : 0), 12, AlignLeft, AlignBottom, ap.bssid);
|
canvas, 38 + (ctx->access_points_count > 99 ? 5 : 0), 12, AlignLeft, AlignBottom, ap.bssid);
|
||||||
|
|
||||||
@@ -148,11 +146,9 @@ static void show_access_point(Canvas* canvas, Context* context) {
|
|||||||
static void render_callback(Canvas* canvas, void* context) {
|
static void render_callback(Canvas* canvas, void* context) {
|
||||||
Context* ctx = context;
|
Context* ctx = context;
|
||||||
|
|
||||||
// hier teken je hoe je projectje eruit ziet
|
|
||||||
|
|
||||||
canvas_draw_frame(canvas, 0, 0, 128, 64);
|
canvas_draw_frame(canvas, 0, 0, 128, 64);
|
||||||
|
|
||||||
canvas_set_font(canvas, FontPrimary); // groot
|
canvas_set_font(canvas, FontPrimary);
|
||||||
|
|
||||||
if(ctx->access_points_count >= MAX_ACCESS_POINTS) {
|
if(ctx->access_points_count >= MAX_ACCESS_POINTS) {
|
||||||
canvas_draw_str(canvas, 118, 10, "!");
|
canvas_draw_str(canvas, 118, 10, "!");
|
||||||
@@ -163,15 +159,12 @@ static void render_callback(Canvas* canvas, void* context) {
|
|||||||
canvas_draw_str(canvas, 80, 40, "Found!");
|
canvas_draw_str(canvas, 80, 40, "Found!");
|
||||||
canvas_draw_icon(canvas, 1, 4, &I_DolphinWait_61x59);
|
canvas_draw_icon(canvas, 1, 4, &I_DolphinWait_61x59);
|
||||||
} else {
|
} else {
|
||||||
// canvas_draw_frame(canvas, 0, 0, 35, 15);
|
|
||||||
canvas_draw_frame(canvas, 0, 0, 35 + (ctx->access_points_count > 99 ? 5 : 0), 15);
|
canvas_draw_frame(canvas, 0, 0, 35 + (ctx->access_points_count > 99 ? 5 : 0), 15);
|
||||||
|
|
||||||
furi_string_printf(
|
furi_string_printf(
|
||||||
ctx->buffer, "%d/%d", ctx->access_points_index + 1, ctx->access_points_count);
|
ctx->buffer, "%d/%d", ctx->access_points_index + 1, ctx->access_points_count);
|
||||||
|
|
||||||
canvas_draw_str(canvas, 3, 12, furi_string_get_cstr(ctx->buffer));
|
canvas_draw_str(canvas, 3, 12, furi_string_get_cstr(ctx->buffer));
|
||||||
// canvas_draw_str_aligned(
|
|
||||||
// canvas, 20, 12, AlignCenter, AlignBottom, furi_string_get_cstr(ctx->buffer));
|
|
||||||
|
|
||||||
show_access_point(canvas, ctx);
|
show_access_point(canvas, ctx);
|
||||||
}
|
}
|
||||||
@@ -238,7 +231,6 @@ static void parseLine(void* context, char* line) {
|
|||||||
while(token != NULL) {
|
while(token != NULL) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 0:
|
case 0:
|
||||||
// strcpy(ap.ssid, token);
|
|
||||||
if(strcmp(token, "AR") == 0) {
|
if(strcmp(token, "AR") == 0) {
|
||||||
isAp = true;
|
isAp = true;
|
||||||
isValid = true;
|
isValid = true;
|
||||||
@@ -436,8 +428,6 @@ static int32_t uart_worker_esp(void* context) {
|
|||||||
// put a null terminator in place of the newline, to delimit the line string
|
// put a null terminator in place of the newline, to delimit the line string
|
||||||
*newline = '\0';
|
*newline = '\0';
|
||||||
|
|
||||||
// FURI_LOG_I(appname, "Received line: %s", line_current);
|
|
||||||
|
|
||||||
parseLine(ctx, line_current);
|
parseLine(ctx, line_current);
|
||||||
|
|
||||||
// move the cursor to the character after the newline
|
// move the cursor to the character after the newline
|
||||||
@@ -593,8 +583,25 @@ static int32_t uart_worker_gps(void* context) {
|
|||||||
int32_t wifisniffer_app(void* p) {
|
int32_t wifisniffer_app(void* p) {
|
||||||
UNUSED(p);
|
UNUSED(p);
|
||||||
|
|
||||||
// alloc everything
|
// if(UART_CH_ESP == UART_CH_GPS) {
|
||||||
|
// FURI_LOG_I(appname, "ESP and GPS uart can't be the same");
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// turn off 5v, so it gets reset on startup
|
||||||
|
if(furi_hal_power_is_otg_enabled()) {
|
||||||
|
furi_hal_power_disable_otg();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable 5v on startup
|
||||||
|
uint8_t attempts = 0;
|
||||||
|
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||||
|
furi_hal_power_enable_otg();
|
||||||
|
furi_delay_ms(10);
|
||||||
|
}
|
||||||
|
furi_delay_ms(200);
|
||||||
|
|
||||||
|
// alloc everything
|
||||||
Context* ctx = malloc(sizeof(Context));
|
Context* ctx = malloc(sizeof(Context));
|
||||||
ctx->queue = furi_message_queue_alloc(8, sizeof(Event));
|
ctx->queue = furi_message_queue_alloc(8, sizeof(Event));
|
||||||
ctx->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
ctx->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||||
@@ -608,7 +615,6 @@ int32_t wifisniffer_app(void* p) {
|
|||||||
ctx->pressedButton = false;
|
ctx->pressedButton = false;
|
||||||
|
|
||||||
//esp uart
|
//esp uart
|
||||||
|
|
||||||
ctx->rx_stream_esp = furi_stream_buffer_alloc(RX_BUF_SIZE * 5, 1);
|
ctx->rx_stream_esp = furi_stream_buffer_alloc(RX_BUF_SIZE * 5, 1);
|
||||||
|
|
||||||
ctx->thread_esp = furi_thread_alloc();
|
ctx->thread_esp = furi_thread_alloc();
|
||||||
@@ -622,14 +628,16 @@ int32_t wifisniffer_app(void* p) {
|
|||||||
if(UART_CH_ESP == FuriHalUartIdUSART1) {
|
if(UART_CH_ESP == FuriHalUartIdUSART1) {
|
||||||
furi_hal_console_disable();
|
furi_hal_console_disable();
|
||||||
} else if(UART_CH_ESP == FuriHalUartIdLPUART1) {
|
} else if(UART_CH_ESP == FuriHalUartIdLPUART1) {
|
||||||
furi_hal_uart_init(UART_CH_ESP, 9600);
|
furi_hal_uart_init(UART_CH_ESP, 115200);
|
||||||
}
|
}
|
||||||
furi_hal_uart_set_br(UART_CH_ESP, 9600);
|
furi_hal_uart_set_br(UART_CH_ESP, 115200);
|
||||||
furi_hal_uart_set_irq_cb(UART_CH_ESP, uart_cb_esp, ctx);
|
furi_hal_uart_set_irq_cb(UART_CH_ESP, uart_cb_esp, ctx);
|
||||||
|
|
||||||
|
furi_hal_uart_tx(UART_CH_ESP, (uint8_t*)"XFW#WIFISNIFF=1\r\n", strlen("XFW#WIFISNIFF=1\r\n"));
|
||||||
//end esp uart
|
//end esp uart
|
||||||
|
|
||||||
//gps uart
|
//gps uart
|
||||||
|
if(UART_CH_ESP != UART_CH_GPS) {
|
||||||
ctx->rx_stream_gps = furi_stream_buffer_alloc(RX_BUF_SIZE * 5, 1);
|
ctx->rx_stream_gps = furi_stream_buffer_alloc(RX_BUF_SIZE * 5, 1);
|
||||||
|
|
||||||
ctx->thread_gps = furi_thread_alloc();
|
ctx->thread_gps = furi_thread_alloc();
|
||||||
@@ -647,6 +655,7 @@ int32_t wifisniffer_app(void* p) {
|
|||||||
}
|
}
|
||||||
furi_hal_uart_set_br(UART_CH_GPS, 9600);
|
furi_hal_uart_set_br(UART_CH_GPS, 9600);
|
||||||
furi_hal_uart_set_irq_cb(UART_CH_GPS, uart_cb_gps, ctx);
|
furi_hal_uart_set_irq_cb(UART_CH_GPS, uart_cb_gps, ctx);
|
||||||
|
}
|
||||||
//end gps uart
|
//end gps uart
|
||||||
|
|
||||||
ViewPort* view_port = view_port_alloc();
|
ViewPort* view_port = view_port_alloc();
|
||||||
@@ -792,9 +801,11 @@ int32_t wifisniffer_app(void* p) {
|
|||||||
furi_thread_join(ctx->thread_esp);
|
furi_thread_join(ctx->thread_esp);
|
||||||
furi_thread_free(ctx->thread_esp);
|
furi_thread_free(ctx->thread_esp);
|
||||||
|
|
||||||
|
if(UART_CH_ESP != UART_CH_GPS) {
|
||||||
furi_thread_flags_set(furi_thread_get_id(ctx->thread_gps), WorkerEvtStop);
|
furi_thread_flags_set(furi_thread_get_id(ctx->thread_gps), WorkerEvtStop);
|
||||||
furi_thread_join(ctx->thread_gps);
|
furi_thread_join(ctx->thread_gps);
|
||||||
furi_thread_free(ctx->thread_gps);
|
furi_thread_free(ctx->thread_gps);
|
||||||
|
}
|
||||||
|
|
||||||
storage_file_close(ctx->file);
|
storage_file_close(ctx->file);
|
||||||
storage_file_free(ctx->file);
|
storage_file_free(ctx->file);
|
||||||
@@ -816,5 +827,9 @@ int32_t wifisniffer_app(void* p) {
|
|||||||
furi_hal_console_enable();
|
furi_hal_console_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(furi_hal_power_is_otg_enabled()) {
|
||||||
|
furi_hal_power_disable_otg();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ void evil_portal_app_free(Evil_PortalApp* app) {
|
|||||||
int32_t evil_portal_app(void* p) {
|
int32_t evil_portal_app(void* p) {
|
||||||
UNUSED(p);
|
UNUSED(p);
|
||||||
|
|
||||||
|
// turn off 5v, so it gets reset on startup
|
||||||
|
if(furi_hal_power_is_otg_enabled()) {
|
||||||
|
furi_hal_power_disable_otg();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable 5v on startup
|
// Enable 5v on startup
|
||||||
uint8_t attempts = 0;
|
uint8_t attempts = 0;
|
||||||
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ Evil_PortalUart* evil_portal_uart_init(Evil_PortalApp* app) {
|
|||||||
furi_hal_uart_set_br(UART_CH, app->BAUDRATE);
|
furi_hal_uart_set_br(UART_CH, app->BAUDRATE);
|
||||||
furi_hal_uart_set_irq_cb(UART_CH, evil_portal_uart_on_irq_cb, uart);
|
furi_hal_uart_set_irq_cb(UART_CH, evil_portal_uart_on_irq_cb, uart);
|
||||||
|
|
||||||
|
evil_portal_uart_tx((uint8_t*)("XFW#EVILPORTAL=1\n"), strlen("XFW#EVILPORTAL=1\n"));
|
||||||
|
|
||||||
return uart;
|
return uart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user