mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 20:48:35 -07:00
Format
This commit is contained in:
@@ -5,11 +5,11 @@ App(
|
|||||||
entry_point="camera_app",
|
entry_point="camera_app",
|
||||||
cdefines=["APP_CAMERA"],
|
cdefines=["APP_CAMERA"],
|
||||||
requires=["gui"],
|
requires=["gui"],
|
||||||
stack_size=8*1024,
|
stack_size=8 * 1024,
|
||||||
order=1,
|
order=1,
|
||||||
fap_icon="icon.png",
|
fap_icon="icon.png",
|
||||||
fap_category="GPIO",
|
fap_category="GPIO",
|
||||||
fap_description="ESP32-CAM live feed and photo capture, use left/right for orientation/mode, up/down for brightness and center for saving a screenshot. [Unplug the USB cable to test with Mayhem]",
|
fap_description="ESP32-CAM live feed and photo capture, use left/right for orientation/mode, up/down for brightness and center for saving a screenshot. [Unplug the USB cable to test with Mayhem]",
|
||||||
fap_author="Z4urce",
|
fap_author="Z4urce",
|
||||||
fap_weburl="https://github.com/Z4urce/flipper-camera"
|
fap_weburl="https://github.com/Z4urce/flipper-camera",
|
||||||
)
|
)
|
||||||
|
|||||||
76
applications/external/esp32cam_camera/camera.c
vendored
76
applications/external/esp32cam_camera/camera.c
vendored
@@ -1,6 +1,5 @@
|
|||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
|
||||||
|
|
||||||
static void camera_view_draw_callback(Canvas* canvas, void* _model) {
|
static void camera_view_draw_callback(Canvas* canvas, void* _model) {
|
||||||
UartDumpModel* model = _model;
|
UartDumpModel* model = _model;
|
||||||
|
|
||||||
@@ -20,8 +19,7 @@ static void camera_view_draw_callback(Canvas* canvas, void* _model) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model->initialized){
|
if(!model->initialized) {
|
||||||
|
|
||||||
/*if(!model->marauderInitialized)
|
/*if(!model->marauderInitialized)
|
||||||
{
|
{
|
||||||
// Init marauder into stream mode
|
// Init marauder into stream mode
|
||||||
@@ -74,22 +72,26 @@ static void save_image(void* context) {
|
|||||||
get_timefilename(file_name);
|
get_timefilename(file_name);
|
||||||
|
|
||||||
// this functions open a file, using write access and creates new file if not exist.
|
// this functions open a file, using write access and creates new file if not exist.
|
||||||
bool result = storage_file_open(file, furi_string_get_cstr(file_name), FSAM_WRITE, FSOM_OPEN_ALWAYS);
|
bool result =
|
||||||
|
storage_file_open(file, furi_string_get_cstr(file_name), FSAM_WRITE, FSOM_OPEN_ALWAYS);
|
||||||
//bool result = storage_file_open(file, EXT_PATH("DCIM/test.bmp"), FSAM_WRITE, FSOM_OPEN_ALWAYS);
|
//bool result = storage_file_open(file, EXT_PATH("DCIM/test.bmp"), FSAM_WRITE, FSOM_OPEN_ALWAYS);
|
||||||
furi_string_free(file_name);
|
furi_string_free(file_name);
|
||||||
|
|
||||||
if (result){
|
if(result) {
|
||||||
storage_file_write(file, bitmap_header, BITMAP_HEADER_LENGTH);
|
storage_file_write(file, bitmap_header, BITMAP_HEADER_LENGTH);
|
||||||
with_view_model(app->view, UartDumpModel * model, {
|
with_view_model(
|
||||||
int8_t row_buffer[ROW_BUFFER_LENGTH];
|
app->view,
|
||||||
for (size_t i = 64; i > 0; --i) {
|
UartDumpModel * model,
|
||||||
for (size_t j = 0; j < ROW_BUFFER_LENGTH; ++j){
|
{
|
||||||
row_buffer[j] = model->pixels[((i-1)*ROW_BUFFER_LENGTH) + j];
|
int8_t row_buffer[ROW_BUFFER_LENGTH];
|
||||||
|
for(size_t i = 64; i > 0; --i) {
|
||||||
|
for(size_t j = 0; j < ROW_BUFFER_LENGTH; ++j) {
|
||||||
|
row_buffer[j] = model->pixels[((i - 1) * ROW_BUFFER_LENGTH) + j];
|
||||||
|
}
|
||||||
|
storage_file_write(file, row_buffer, ROW_BUFFER_LENGTH);
|
||||||
}
|
}
|
||||||
storage_file_write(file, row_buffer, ROW_BUFFER_LENGTH);
|
},
|
||||||
}
|
false);
|
||||||
|
|
||||||
}, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closing the "file descriptor"
|
// Closing the "file descriptor"
|
||||||
@@ -102,21 +104,17 @@ static void save_image(void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool camera_view_input_callback(InputEvent* event, void* context) {
|
static bool camera_view_input_callback(InputEvent* event, void* context) {
|
||||||
if (event->type == InputTypePress){
|
if(event->type == InputTypePress) {
|
||||||
uint8_t data[1];
|
uint8_t data[1];
|
||||||
if (event->key == InputKeyUp){
|
if(event->key == InputKeyUp) {
|
||||||
data[0] = 'C';
|
data[0] = 'C';
|
||||||
}
|
} else if(event->key == InputKeyDown) {
|
||||||
else if (event->key == InputKeyDown){
|
|
||||||
data[0] = 'c';
|
data[0] = 'c';
|
||||||
}
|
} else if(event->key == InputKeyRight) {
|
||||||
else if (event->key == InputKeyRight){
|
|
||||||
data[0] = '>';
|
data[0] = '>';
|
||||||
}
|
} else if(event->key == InputKeyLeft) {
|
||||||
else if (event->key == InputKeyLeft){
|
|
||||||
data[0] = '<';
|
data[0] = '<';
|
||||||
}
|
} else if(event->key == InputKeyOk) {
|
||||||
else if (event->key == InputKeyOk){
|
|
||||||
save_image(context);
|
save_image(context);
|
||||||
}
|
}
|
||||||
furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
|
furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
|
||||||
@@ -141,36 +139,39 @@ static void camera_on_irq_cb(UartIrqEvent ev, uint8_t data, void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void process_ringbuffer(UartDumpModel* model, uint8_t byte) {
|
static void process_ringbuffer(UartDumpModel* model, uint8_t byte) {
|
||||||
|
|
||||||
//// 1. Phase: filling the ringbuffer
|
//// 1. Phase: filling the ringbuffer
|
||||||
if (model->ringbuffer_index == 0 && byte != 'Y'){ // First char has to be 'Y' in the buffer.
|
if(model->ringbuffer_index == 0 && byte != 'Y') { // First char has to be 'Y' in the buffer.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model->ringbuffer_index == 1 && byte != ':'){ // Second char has to be ':' in the buffer or reset.
|
if(model->ringbuffer_index == 1 &&
|
||||||
|
byte != ':') { // Second char has to be ':' in the buffer or reset.
|
||||||
model->ringbuffer_index = 0;
|
model->ringbuffer_index = 0;
|
||||||
process_ringbuffer(model, byte);
|
process_ringbuffer(model, byte);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
model->row_ringbuffer[model->ringbuffer_index] = byte; // Assign current byte to the ringbuffer;
|
model->row_ringbuffer[model->ringbuffer_index] =
|
||||||
|
byte; // Assign current byte to the ringbuffer;
|
||||||
++model->ringbuffer_index; // Increment the ringbuffer index
|
++model->ringbuffer_index; // Increment the ringbuffer index
|
||||||
|
|
||||||
if (model->ringbuffer_index < RING_BUFFER_LENGTH){ // Let's wait 'till the buffer fills.
|
if(model->ringbuffer_index < RING_BUFFER_LENGTH) { // Let's wait 'till the buffer fills.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//// 2. Phase: flushing the ringbuffer to the framebuffer
|
//// 2. Phase: flushing the ringbuffer to the framebuffer
|
||||||
model->ringbuffer_index = 0; // Let's reset the ringbuffer
|
model->ringbuffer_index = 0; // Let's reset the ringbuffer
|
||||||
model->initialized = true; // We've successfully established the connection
|
model->initialized = true; // We've successfully established the connection
|
||||||
size_t row_start_index = model->row_ringbuffer[2] * ROW_BUFFER_LENGTH; // Third char will determine the row number
|
size_t row_start_index =
|
||||||
|
model->row_ringbuffer[2] * ROW_BUFFER_LENGTH; // Third char will determine the row number
|
||||||
|
|
||||||
if (row_start_index > LAST_ROW_INDEX){ // Failsafe
|
if(row_start_index > LAST_ROW_INDEX) { // Failsafe
|
||||||
row_start_index = 0;
|
row_start_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < ROW_BUFFER_LENGTH; ++i) {
|
for(size_t i = 0; i < ROW_BUFFER_LENGTH; ++i) {
|
||||||
model->pixels[row_start_index + i] = model->row_ringbuffer[i+3]; // Writing the remaining 16 bytes into the frame buffer
|
model->pixels[row_start_index + i] =
|
||||||
|
model->row_ringbuffer[i + 3]; // Writing the remaining 16 bytes into the frame buffer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +196,8 @@ static int32_t camera_worker(void* context) {
|
|||||||
//furi_hal_uart_tx(FuriHalUartIdUSART1, data, length);
|
//furi_hal_uart_tx(FuriHalUartIdUSART1, data, length);
|
||||||
with_view_model(
|
with_view_model(
|
||||||
app->view,
|
app->view,
|
||||||
UartDumpModel * model, {
|
UartDumpModel * model,
|
||||||
|
{
|
||||||
for(size_t i = 0; i < length; i++) {
|
for(size_t i = 0; i < length; i++) {
|
||||||
process_ringbuffer(model, data[i]);
|
process_ringbuffer(model, data[i]);
|
||||||
}
|
}
|
||||||
@@ -205,7 +207,8 @@ static int32_t camera_worker(void* context) {
|
|||||||
} while(length > 0);
|
} while(length > 0);
|
||||||
|
|
||||||
notification_message(app->notification, &sequence_notification);
|
notification_message(app->notification, &sequence_notification);
|
||||||
with_view_model(app->view, UartDumpModel * model, { UNUSED(model); }, true);
|
with_view_model(
|
||||||
|
app->view, UartDumpModel * model, { UNUSED(model); }, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,8 +263,7 @@ static UartEchoApp* camera_app_alloc() {
|
|||||||
furi_delay_ms(200);
|
furi_delay_ms(200);
|
||||||
furi_hal_power_enable_external_3_3v();
|
furi_hal_power_enable_external_3_3v();
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
for(int i=0;i<2;i++)
|
for(int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
furi_delay_ms(500);
|
furi_delay_ms(500);
|
||||||
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'c'}, 1);
|
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'c'}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
39
applications/external/esp32cam_camera/camera.h
vendored
39
applications/external/esp32cam_camera/camera.h
vendored
@@ -26,7 +26,8 @@
|
|||||||
#define FRAME_WIDTH 128
|
#define FRAME_WIDTH 128
|
||||||
#define FRAME_HEIGTH 64
|
#define FRAME_HEIGTH 64
|
||||||
#define FRAME_BIT_DEPTH 1
|
#define FRAME_BIT_DEPTH 1
|
||||||
#define FRAME_BUFFER_LENGTH (FRAME_WIDTH * FRAME_HEIGTH * FRAME_BIT_DEPTH / 8) // 128*64*1 / 8 = 1024
|
#define FRAME_BUFFER_LENGTH \
|
||||||
|
(FRAME_WIDTH * FRAME_HEIGTH * FRAME_BIT_DEPTH / 8) // 128*64*1 / 8 = 1024
|
||||||
#define ROW_BUFFER_LENGTH (FRAME_WIDTH / 8) // 128/8 = 16
|
#define ROW_BUFFER_LENGTH (FRAME_WIDTH / 8) // 128/8 = 16
|
||||||
#define LAST_ROW_INDEX (FRAME_BUFFER_LENGTH - ROW_BUFFER_LENGTH) // 1024 - 16 = 1008
|
#define LAST_ROW_INDEX (FRAME_BUFFER_LENGTH - ROW_BUFFER_LENGTH) // 1024 - 16 = 1008
|
||||||
#define RING_BUFFER_LENGTH (ROW_BUFFER_LENGTH + 3) // ROW_BUFFER_LENGTH + Header => 16 + 3 = 19
|
#define RING_BUFFER_LENGTH (ROW_BUFFER_LENGTH + 3) // ROW_BUFFER_LENGTH + Header => 16 + 3 = 19
|
||||||
@@ -34,17 +35,35 @@
|
|||||||
#define IMAGE_FILE_DIRECTORY_PATH EXT_PATH("DCIM")
|
#define IMAGE_FILE_DIRECTORY_PATH EXT_PATH("DCIM")
|
||||||
|
|
||||||
static const unsigned char bitmap_header[BITMAP_HEADER_LENGTH] = {
|
static const unsigned char bitmap_header[BITMAP_HEADER_LENGTH] = {
|
||||||
0x42, 0x4D, 0x3E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00,
|
0x42, 0x4D, 0x3E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x28, 0x00,
|
||||||
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x00,
|
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
|
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00};
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
|
||||||
0xFF, 0x00
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t _I_DolphinCommon_56x48_0[] = {0x01,0x00,0xdf,0x00,0x00,0x1f,0xfe,0x0e,0x05,0x3f,0x04,0x06,0x78,0x06,0x30,0x20,0xf8,0x00,0xc6,0x12,0x1c,0x04,0x0c,0x0a,0x38,0x08,0x08,0x0c,0x60,0xc0,0x21,0xe0,0x04,0x0a,0x18,0x02,0x1b,0x00,0x18,0xa3,0x00,0x21,0x90,0x01,0x8a,0x20,0x02,0x19,0x80,0x18,0x80,0x64,0x09,0x20,0x89,0x81,0x8c,0x3e,0x41,0xe2,0x80,0x50,0x00,0x43,0x08,0x01,0x0c,0xfc,0x68,0x40,0x61,0xc0,0x50,0x30,0x00,0x63,0xa0,0x7f,0x80,0xc4,0x41,0x19,0x07,0xff,0x02,0x06,0x18,0x24,0x03,0x41,0xf3,0x2b,0x10,0x19,0x38,0x10,0x30,0x31,0x7f,0xe0,0x34,0x08,0x30,0x19,0x60,0x80,0x65,0x86,0x0a,0x4c,0x0c,0x30,0x81,0xb9,0x41,0xa0,0x54,0x08,0xc7,0xe2,0x06,0x8a,0x18,0x25,0x02,0x21,0x0f,0x19,0x88,0xd8,0x6e,0x1b,0x01,0xd1,0x1b,0x86,0x39,0x66,0x3a,0xa4,0x1a,0x50,0x06,0x48,0x18,0x18,0xd0,0x03,0x01,0x41,0x98,0xcc,0x60,0x39,0x01,0x49,0x2d,0x06,0x03,0x50,0xf8,0x40,0x3e,0x02,0xc1,0x82,0x86,0xc7,0xfe,0x0f,0x28,0x2c,0x91,0xd2,0x90,0x9a,0x18,0x19,0x3e,0x6d,0x73,0x12,0x16,0x00,0x32,0x49,0x72,0xc0,0x7e,0x5d,0x44,0xba,0x2c,0x08,0xa4,0xc8,0x82,0x06,0x17,0xe0,0x81,0x90,0x2a,0x40,0x61,0xe1,0xa2,0x44,0x0c,0x76,0x2b,0xe8,0x89,0x26,0x43,0x83,0x31,0x8c,0x78,0x0c,0xb0,0x48,0x10,0x1a,0xe0,0x00,0x63,};
|
const uint8_t _I_DolphinCommon_56x48_0[] = {
|
||||||
|
0x01, 0x00, 0xdf, 0x00, 0x00, 0x1f, 0xfe, 0x0e, 0x05, 0x3f, 0x04, 0x06, 0x78, 0x06, 0x30, 0x20,
|
||||||
|
0xf8, 0x00, 0xc6, 0x12, 0x1c, 0x04, 0x0c, 0x0a, 0x38, 0x08, 0x08, 0x0c, 0x60, 0xc0, 0x21, 0xe0,
|
||||||
|
0x04, 0x0a, 0x18, 0x02, 0x1b, 0x00, 0x18, 0xa3, 0x00, 0x21, 0x90, 0x01, 0x8a, 0x20, 0x02, 0x19,
|
||||||
|
0x80, 0x18, 0x80, 0x64, 0x09, 0x20, 0x89, 0x81, 0x8c, 0x3e, 0x41, 0xe2, 0x80, 0x50, 0x00, 0x43,
|
||||||
|
0x08, 0x01, 0x0c, 0xfc, 0x68, 0x40, 0x61, 0xc0, 0x50, 0x30, 0x00, 0x63, 0xa0, 0x7f, 0x80, 0xc4,
|
||||||
|
0x41, 0x19, 0x07, 0xff, 0x02, 0x06, 0x18, 0x24, 0x03, 0x41, 0xf3, 0x2b, 0x10, 0x19, 0x38, 0x10,
|
||||||
|
0x30, 0x31, 0x7f, 0xe0, 0x34, 0x08, 0x30, 0x19, 0x60, 0x80, 0x65, 0x86, 0x0a, 0x4c, 0x0c, 0x30,
|
||||||
|
0x81, 0xb9, 0x41, 0xa0, 0x54, 0x08, 0xc7, 0xe2, 0x06, 0x8a, 0x18, 0x25, 0x02, 0x21, 0x0f, 0x19,
|
||||||
|
0x88, 0xd8, 0x6e, 0x1b, 0x01, 0xd1, 0x1b, 0x86, 0x39, 0x66, 0x3a, 0xa4, 0x1a, 0x50, 0x06, 0x48,
|
||||||
|
0x18, 0x18, 0xd0, 0x03, 0x01, 0x41, 0x98, 0xcc, 0x60, 0x39, 0x01, 0x49, 0x2d, 0x06, 0x03, 0x50,
|
||||||
|
0xf8, 0x40, 0x3e, 0x02, 0xc1, 0x82, 0x86, 0xc7, 0xfe, 0x0f, 0x28, 0x2c, 0x91, 0xd2, 0x90, 0x9a,
|
||||||
|
0x18, 0x19, 0x3e, 0x6d, 0x73, 0x12, 0x16, 0x00, 0x32, 0x49, 0x72, 0xc0, 0x7e, 0x5d, 0x44, 0xba,
|
||||||
|
0x2c, 0x08, 0xa4, 0xc8, 0x82, 0x06, 0x17, 0xe0, 0x81, 0x90, 0x2a, 0x40, 0x61, 0xe1, 0xa2, 0x44,
|
||||||
|
0x0c, 0x76, 0x2b, 0xe8, 0x89, 0x26, 0x43, 0x83, 0x31, 0x8c, 0x78, 0x0c, 0xb0, 0x48, 0x10, 0x1a,
|
||||||
|
0xe0, 0x00, 0x63,
|
||||||
|
};
|
||||||
const uint8_t* const _I_DolphinCommon_56x48[] = {_I_DolphinCommon_56x48_0};
|
const uint8_t* const _I_DolphinCommon_56x48[] = {_I_DolphinCommon_56x48_0};
|
||||||
const Icon I_DolphinCommon_56x48 = {.width=56,.height=48,.frame_count=1,.frame_rate=0,.frames=_I_DolphinCommon_56x48};
|
const Icon I_DolphinCommon_56x48 = {
|
||||||
|
.width = 56,
|
||||||
|
.height = 48,
|
||||||
|
.frame_count = 1,
|
||||||
|
.frame_rate = 0,
|
||||||
|
.frames = _I_DolphinCommon_56x48};
|
||||||
|
|
||||||
typedef struct UartDumpModel UartDumpModel;
|
typedef struct UartDumpModel UartDumpModel;
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ App(
|
|||||||
order=2,
|
order=2,
|
||||||
fap_icon="wifi_10px.png",
|
fap_icon="wifi_10px.png",
|
||||||
fap_category="GPIO",
|
fap_category="GPIO",
|
||||||
fap_description="ESP32-CAM version of Marauder. Includes all functionality from the original plus some options to trigger the camera and flashlight. [Unplug the USB cable to test with Mayhem]"
|
fap_description="ESP32-CAM version of Marauder. Includes all functionality from the original plus some options to trigger the camera and flashlight. [Unplug the USB cable to test with Mayhem]",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If it is a sniff function, open the pcap file for recording
|
// If it is a sniff function, open the pcap file for recording
|
||||||
if(app->ok_to_save_pcaps && strncmp("sniff", app->selected_tx_string, strlen("sniff")) == 0) {
|
if(app->ok_to_save_pcaps &&
|
||||||
|
strncmp("sniff", app->selected_tx_string, strlen("sniff")) == 0) {
|
||||||
app->is_writing_pcap = true;
|
app->is_writing_pcap = true;
|
||||||
wifi_marauder_create_pcap_file(app);
|
wifi_marauder_create_pcap_file(app);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,18 +112,23 @@ void wifi_marauder_scene_log_viewer_on_enter(void* context) {
|
|||||||
app->open_log_file_page = 0;
|
app->open_log_file_page = 0;
|
||||||
app->open_log_file_num_pages = 0;
|
app->open_log_file_num_pages = 0;
|
||||||
bool saved_logs_exist = false;
|
bool saved_logs_exist = false;
|
||||||
if (!app->has_saved_logs_this_session && furi_string_empty(app->text_box_store)) {
|
if(!app->has_saved_logs_this_session && furi_string_empty(app->text_box_store)) {
|
||||||
// no commands sent yet this session, find last saved log
|
// no commands sent yet this session, find last saved log
|
||||||
if (storage_dir_open(app->log_file, MARAUDER_APP_FOLDER_LOGS)) {
|
if(storage_dir_open(app->log_file, MARAUDER_APP_FOLDER_LOGS)) {
|
||||||
char name[70];
|
char name[70];
|
||||||
char lastname[70];
|
char lastname[70];
|
||||||
while (storage_dir_read(app->log_file, NULL, name, sizeof(name))) {
|
while(storage_dir_read(app->log_file, NULL, name, sizeof(name))) {
|
||||||
// keep reading directory until last file is reached
|
// keep reading directory until last file is reached
|
||||||
strlcpy(lastname, name, sizeof(lastname));
|
strlcpy(lastname, name, sizeof(lastname));
|
||||||
saved_logs_exist = true;
|
saved_logs_exist = true;
|
||||||
}
|
}
|
||||||
if (saved_logs_exist) {
|
if(saved_logs_exist) {
|
||||||
snprintf(app->log_file_path, sizeof(app->log_file_path), "%s/%s", MARAUDER_APP_FOLDER_LOGS, lastname);
|
snprintf(
|
||||||
|
app->log_file_path,
|
||||||
|
sizeof(app->log_file_path),
|
||||||
|
"%s/%s",
|
||||||
|
MARAUDER_APP_FOLDER_LOGS,
|
||||||
|
lastname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storage_dir_close(app->log_file);
|
storage_dir_close(app->log_file);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
|
|||||||
TOGGLE_ARGS,
|
TOGGLE_ARGS,
|
||||||
FOCUS_CONSOLE_END,
|
FOCUS_CONSOLE_END,
|
||||||
NO_TIP},
|
NO_TIP},
|
||||||
{"Camera",
|
{"Camera",
|
||||||
{"photo", "flashlight"},
|
{"photo", "flashlight"},
|
||||||
2,
|
2,
|
||||||
{"photo", "flashlight"},
|
{"photo", "flashlight"},
|
||||||
|
|||||||
@@ -163,8 +163,7 @@ int32_t wifi_marauder_app(void* p) {
|
|||||||
furi_delay_ms(200);
|
furi_delay_ms(200);
|
||||||
furi_hal_power_enable_external_3_3v();
|
furi_hal_power_enable_external_3_3v();
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
for(int i=0;i<2;i++)
|
for(int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
furi_delay_ms(500);
|
furi_delay_ms(500);
|
||||||
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'w'}, 1);
|
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'w'}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ void uart_terminal_scene_console_output_on_enter(void* context) {
|
|||||||
app->text_box_store_strlen = 0;
|
app->text_box_store_strlen = 0;
|
||||||
|
|
||||||
// app->show_stopscan_tip in the if is just a hack to get the help displayed since there is no commands in this app
|
// app->show_stopscan_tip in the if is just a hack to get the help displayed since there is no commands in this app
|
||||||
if(app->show_stopscan_tip || 0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
if(app->show_stopscan_tip ||
|
||||||
|
0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
||||||
const char* help_msg =
|
const char* help_msg =
|
||||||
"Morse Flasher for\nMayhem Fin\n\nBased on UART terminal by\ncool4uma, which is a\nmodified WiFi Marauder\ncompanion by 0xchocolate\n\n";
|
"Morse Flasher for\nMayhem Fin\n\nBased on UART terminal by\ncool4uma, which is a\nmodified WiFi Marauder\ncompanion by 0xchocolate\n\n";
|
||||||
furi_string_cat_str(app->text_box_store, help_msg);
|
furi_string_cat_str(app->text_box_store, help_msg);
|
||||||
|
|||||||
@@ -27,7 +27,14 @@ const UART_TerminalItem items[NUM_MENU_ITEMS] = {
|
|||||||
{"Quick message",
|
{"Quick message",
|
||||||
{"SOS", "CQD", "VVV", "Eureka", "E.T ph...", "what h...", "Mayhem", "Flipper"},
|
{"SOS", "CQD", "VVV", "Eureka", "E.T ph...", "what h...", "Mayhem", "Flipper"},
|
||||||
8,
|
8,
|
||||||
{"sos", "cqd", "vvv", "eureka", "e.t. phone home", "what hath god wrought!", "let the mayhem begin", "flipper zero in da housa"},
|
{"sos",
|
||||||
|
"cqd",
|
||||||
|
"vvv",
|
||||||
|
"eureka",
|
||||||
|
"e.t. phone home",
|
||||||
|
"what hath god wrought!",
|
||||||
|
"let the mayhem begin",
|
||||||
|
"flipper zero in da housa"},
|
||||||
NO_ARGS,
|
NO_ARGS,
|
||||||
FOCUS_CONSOLE_END,
|
FOCUS_CONSOLE_END,
|
||||||
NO_TIP},
|
NO_TIP},
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ UART_TerminalApp* uart_terminal_app_alloc() {
|
|||||||
|
|
||||||
app->text_input = uart_text_input_alloc();
|
app->text_input = uart_text_input_alloc();
|
||||||
view_dispatcher_add_view(
|
view_dispatcher_add_view(
|
||||||
app->view_dispatcher, UART_TerminalAppViewTextInput, uart_text_input_get_view(app->text_input));
|
app->view_dispatcher,
|
||||||
|
UART_TerminalAppViewTextInput,
|
||||||
|
uart_text_input_get_view(app->text_input));
|
||||||
|
|
||||||
scene_manager_next_scene(app->scene_manager, UART_TerminalSceneStart);
|
scene_manager_next_scene(app->scene_manager, UART_TerminalSceneStart);
|
||||||
|
|
||||||
@@ -95,8 +97,7 @@ int32_t uart_terminal_app(void* p) {
|
|||||||
furi_delay_ms(200);
|
furi_delay_ms(200);
|
||||||
furi_hal_power_enable_external_3_3v();
|
furi_hal_power_enable_external_3_3v();
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
for(int i=0;i<2;i++)
|
for(int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
furi_delay_ms(500);
|
furi_delay_ms(500);
|
||||||
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'.'}, 1);
|
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'.'}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ UART_TerminalUart* uart_terminal_uart_init(UART_TerminalApp* app) {
|
|||||||
furi_hal_uart_set_irq_cb(UART_CH, uart_terminal_uart_on_irq_cb, uart);*/
|
furi_hal_uart_set_irq_cb(UART_CH, uart_terminal_uart_on_irq_cb, uart);*/
|
||||||
|
|
||||||
uart->app = app;
|
uart->app = app;
|
||||||
uart->rx_stream = furi_stream_buffer_alloc(RX_BUF_SIZE, 1);
|
uart->rx_stream = furi_stream_buffer_alloc(RX_BUF_SIZE, 1);
|
||||||
uart->rx_thread = furi_thread_alloc();
|
uart->rx_thread = furi_thread_alloc();
|
||||||
furi_thread_set_name(uart->rx_thread, "UART_TerminalUartRxThread");
|
furi_thread_set_name(uart->rx_thread, "UART_TerminalUartRxThread");
|
||||||
furi_thread_set_stack_size(uart->rx_thread, 1024);
|
furi_thread_set_stack_size(uart->rx_thread, 1024);
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ App(
|
|||||||
entry_point="uart_echo_app",
|
entry_point="uart_echo_app",
|
||||||
cdefines=["APP_QRCODE"],
|
cdefines=["APP_QRCODE"],
|
||||||
requires=["gui"],
|
requires=["gui"],
|
||||||
stack_size=8*1024,
|
stack_size=8 * 1024,
|
||||||
order=1,
|
order=1,
|
||||||
fap_icon="icon.png",
|
fap_icon="icon.png",
|
||||||
fap_category="GPIO",
|
fap_category="GPIO",
|
||||||
fap_description="ESP32-CAM Motion detection. It generates a beep when motion is detected. Can be extended to trigger more stuff in the code. [Unplug the USB cable to test with Mayhem]",
|
fap_description="ESP32-CAM Motion detection. It generates a beep when motion is detected. Can be extended to trigger more stuff in the code. [Unplug the USB cable to test with Mayhem]",
|
||||||
fap_author="eried",
|
fap_author="eried",
|
||||||
fap_weburl="https://flipper.ried.cl"
|
fap_weburl="https://flipper.ried.cl",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ static void uart_echo_on_irq_cb(UartIrqEvent ev, uint8_t data, void* context) {
|
|||||||
|
|
||||||
static void uart_echo_push_to_list(UartDumpModel* model, void* context, const char data) {
|
static void uart_echo_push_to_list(UartDumpModel* model, void* context, const char data) {
|
||||||
// Alarm sound
|
// Alarm sound
|
||||||
if(data == '!'){
|
if(data == '!') {
|
||||||
UartEchoApp* app = context;
|
UartEchoApp* app = context;
|
||||||
notification_message(app->notification, &sequence_alarm);
|
notification_message(app->notification, &sequence_alarm);
|
||||||
}
|
}
|
||||||
@@ -185,8 +185,7 @@ static UartEchoApp* uart_echo_app_alloc() {
|
|||||||
furi_delay_ms(200);
|
furi_delay_ms(200);
|
||||||
furi_hal_power_enable_external_3_3v();
|
furi_hal_power_enable_external_3_3v();
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
for(int i=0;i<2;i++)
|
for(int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
furi_delay_ms(500);
|
furi_delay_ms(500);
|
||||||
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'m'}, 1);
|
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'m'}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ App(
|
|||||||
entry_point="uart_echo_app",
|
entry_point="uart_echo_app",
|
||||||
cdefines=["APP_QRCODE"],
|
cdefines=["APP_QRCODE"],
|
||||||
requires=["gui"],
|
requires=["gui"],
|
||||||
stack_size=8*1024,
|
stack_size=8 * 1024,
|
||||||
order=1,
|
order=1,
|
||||||
fap_icon="icon.png",
|
fap_icon="icon.png",
|
||||||
fap_category="GPIO",
|
fap_category="GPIO",
|
||||||
fap_description="ESP32-CAM simple app to start a remote camera. [Unplug the USB cable to test with Mayhem]",
|
fap_description="ESP32-CAM simple app to start a remote camera. [Unplug the USB cable to test with Mayhem]",
|
||||||
fap_author="eried",
|
fap_author="eried",
|
||||||
fap_weburl="https://flipper.ried.cl"
|
fap_weburl="https://flipper.ried.cl",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -179,8 +179,7 @@ static UartEchoApp* uart_echo_app_alloc() {
|
|||||||
furi_delay_ms(200);
|
furi_delay_ms(200);
|
||||||
furi_hal_power_enable_external_3_3v();
|
furi_hal_power_enable_external_3_3v();
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
for(int i=0;i<2;i++)
|
for(int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
furi_delay_ms(500);
|
furi_delay_ms(500);
|
||||||
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'n'}, 1);
|
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'n'}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ App(
|
|||||||
entry_point="uart_echo_app",
|
entry_point="uart_echo_app",
|
||||||
cdefines=["APP_QRCODE"],
|
cdefines=["APP_QRCODE"],
|
||||||
requires=["gui"],
|
requires=["gui"],
|
||||||
stack_size=8*1024,
|
stack_size=8 * 1024,
|
||||||
order=1,
|
order=1,
|
||||||
fap_icon="icon.png",
|
fap_icon="icon.png",
|
||||||
fap_category="GPIO",
|
fap_category="GPIO",
|
||||||
fap_description="ESP32-CAM simple app to show a payload from QR codes. Can be extended to trigger more stuff in the code. [Unplug the USB cable to test with Mayhem]",
|
fap_description="ESP32-CAM simple app to show a payload from QR codes. Can be extended to trigger more stuff in the code. [Unplug the USB cable to test with Mayhem]",
|
||||||
fap_author="eried",
|
fap_author="eried",
|
||||||
fap_weburl="https://flipper.ried.cl"
|
fap_weburl="https://flipper.ried.cl",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -179,8 +179,7 @@ static UartEchoApp* uart_echo_app_alloc() {
|
|||||||
furi_delay_ms(200);
|
furi_delay_ms(200);
|
||||||
furi_hal_power_enable_external_3_3v();
|
furi_hal_power_enable_external_3_3v();
|
||||||
furi_hal_power_enable_otg();
|
furi_hal_power_enable_otg();
|
||||||
for(int i=0;i<2;i++)
|
for(int i = 0; i < 2; i++) {
|
||||||
{
|
|
||||||
furi_delay_ms(500);
|
furi_delay_ms(500);
|
||||||
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'q'}, 1);
|
furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'q'}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user