Willy-JL 1 год назад
Родитель
Сommit
570e72f162

+ 1 - 0
ethernet/.gitsubtree

@@ -1 +1,2 @@
 https://github.com/arag0re/fz-eth-troubleshooter master /
 https://github.com/arag0re/fz-eth-troubleshooter master /
+https://github.com/karasevia/finik_eth main /

+ 6 - 5
ethernet/application.fam

@@ -1,9 +1,9 @@
 App(
 App(
-    appid="eth_troubleshooter",
-    name="Ethernet Troubleshooter",
+    appid="ethernet",
+    name="[W5500] Ethernet",
     apptype=FlipperAppType.EXTERNAL,
     apptype=FlipperAppType.EXTERNAL,
-    entry_point="eth_troubleshooter_app",
-    cdefines=["ETH_TROUBLESHOOTER"],
+    entry_point="finik_eth_app",
+    cdefines=["FINIK_ETH"],
     requires=[
     requires=[
         "gui",
         "gui",
         "power",
         "power",
@@ -12,8 +12,9 @@ App(
     order=90,
     order=90,
     fap_icon="images/ethernet_icon_10x10px.png",
     fap_icon="images/ethernet_icon_10x10px.png",
     fap_version="1.0",
     fap_version="1.0",
-    fap_category="GPIO",
+    fap_category="GPIO/Debug",
     fap_icon_assets="images",
     fap_icon_assets="images",
+    fap_icon_assets_symbol="finik_eth",
     fap_private_libs=[
     fap_private_libs=[
         Lib(
         Lib(
             cflags=[
             cflags=[

+ 1 - 1
ethernet/eth_save_process.c

@@ -277,7 +277,7 @@ EthernetSaveConfig* ethernet_save_process_malloc() {
 
 
 void ethernet_save_process_print(EthernetSaveConfig* config, const char* str) {
 void ethernet_save_process_print(EthernetSaveConfig* config, const char* str) {
     furi_assert(config);
     furi_assert(config);
-    FuriHalRtcDateTime datetime = {0};
+    DateTime datetime = {0};
     furi_hal_rtc_get_datetime(&datetime);
     furi_hal_rtc_get_datetime(&datetime);
     storage_printf(
     storage_printf(
         config->log_file,
         config->log_file,

+ 3 - 1
ethernet/eth_view_process.c

@@ -2,13 +2,15 @@
 
 
 #include "eth_worker.h"
 #include "eth_worker.h"
 #include "eth_worker_i.h"
 #include "eth_worker_i.h"
-#include "eth_troubleshooter_icons.h"
+#include "finik_eth_icons.h"
 
 
 #include <furi_hal.h>
 #include <furi_hal.h>
 #include <gui/gui.h>
 #include <gui/gui.h>
 #include <gui/canvas.h>
 #include <gui/canvas.h>
 #include <string.h>
 #include <string.h>
 
 
+#include "u8g2.h"
+
 #define TAG "EthView"
 #define TAG "EthView"
 
 
 EthViewProcess* ethernet_view_process_malloc(EthWorkerProcess type, EthernetSaveConfig* config) {
 EthViewProcess* ethernet_view_process_malloc(EthWorkerProcess type, EthernetSaveConfig* config) {

+ 0 - 139
ethernet/eth_view_process.h

@@ -4,7 +4,6 @@
 #include "eth_save_process.h"
 #include "eth_save_process.h"
 #include <gui/gui.h>
 #include <gui/gui.h>
 
 
-
 #define SCREEN_SYMBOLS_WIDTH 30
 #define SCREEN_SYMBOLS_WIDTH 30
 
 
 EthViewProcess* ethernet_view_process_malloc(EthWorkerProcess type, EthernetSaveConfig* config);
 EthViewProcess* ethernet_view_process_malloc(EthWorkerProcess type, EthernetSaveConfig* config);
@@ -16,144 +15,6 @@ void ethernet_view_process_print(EthViewProcess* process, const char* str);
 void ethernet_view_process_move(EthViewProcess* process, int8_t shift);
 void ethernet_view_process_move(EthViewProcess* process, int8_t shift);
 void evp_printf(EthViewProcess* process, const char* format, ...);
 void evp_printf(EthViewProcess* process, const char* format, ...);
 
 
-typedef struct u8x8_struct u8x8_t;
-typedef struct u8x8_display_info_struct u8x8_display_info_t;
-typedef struct u8x8_tile_struct u8x8_tile_t;
-
-typedef uint8_t (*u8x8_msg_cb)(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr);
-typedef uint16_t (*u8x8_char_cb)(u8x8_t* u8x8, uint8_t b);
-struct u8x8_struct {
-    const u8x8_display_info_t* display_info;
-    u8x8_char_cb next_cb;
-    u8x8_msg_cb display_cb;
-    u8x8_msg_cb cad_cb;
-    u8x8_msg_cb byte_cb;
-    u8x8_msg_cb gpio_and_delay_cb;
-    uint32_t bus_clock;
-    const uint8_t* font;
-    uint16_t encoding; 
-    uint8_t x_offset;
-    uint8_t is_font_inverse_mode; 
-    uint8_t
-        i2c_address;
-    uint8_t i2c_started;
-    uint8_t utf8_state; 
-    uint8_t gpio_result;
-    uint8_t debounce_default_pin_state;
-    uint8_t debounce_last_pin_state;
-    uint8_t debounce_state;
-    uint8_t debounce_result_msg;
-};
-
-typedef uint8_t u8g2_uint_t; 
-typedef int8_t u8g2_int_t; 
-typedef int16_t u8g2_long_t;
-
-typedef struct u8g2_struct u8g2_t;
-typedef struct u8g2_cb_struct u8g2_cb_t;
-
-typedef void (*u8g2_update_dimension_cb)(u8g2_t* u8g2);
-typedef void (*u8g2_update_page_win_cb)(u8g2_t* u8g2);
-typedef void (
-    *u8g2_draw_l90_cb)(u8g2_t* u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir);
-typedef void (*u8g2_draw_ll_hvline_cb)(
-    u8g2_t* u8g2,
-    u8g2_uint_t x,
-    u8g2_uint_t y,
-    u8g2_uint_t len,
-    uint8_t dir);
-
-typedef uint8_t (*u8g2_get_kerning_cb)(u8g2_t* u8g2, uint16_t e1, uint16_t e2);
-
-struct _u8g2_font_info_t {
-    uint8_t glyph_cnt;
-    uint8_t bbx_mode;
-    uint8_t bits_per_0;
-    uint8_t bits_per_1;
-    uint8_t bits_per_char_width;
-    uint8_t bits_per_char_height;
-    uint8_t bits_per_char_x;
-    uint8_t bits_per_char_y;
-    uint8_t bits_per_delta_x;
-    int8_t max_char_width;
-    int8_t
-        max_char_height; 
-    int8_t x_offset;
-    int8_t y_offset;
-    int8_t ascent_A;
-    int8_t descent_g; 
-    int8_t ascent_para;
-    int8_t descent_para;
-    uint16_t start_pos_upper_A;
-    uint16_t start_pos_lower_a;
-};
-typedef struct _u8g2_font_info_t u8g2_font_info_t;
-
-
-struct _u8g2_font_decode_t {
-    const uint8_t* decode_ptr; 
-    u8g2_uint_t target_x;
-    u8g2_uint_t target_y;
-    int8_t x; 
-    int8_t y;
-    int8_t glyph_width;
-    int8_t glyph_height;
-    uint8_t decode_bit_pos; 
-    uint8_t is_transparent;
-    uint8_t fg_color;
-    uint8_t bg_color;
-};
-typedef struct _u8g2_font_decode_t u8g2_font_decode_t;
-
-struct _u8g2_kerning_t {
-    uint16_t first_table_cnt;
-    uint16_t second_table_cnt;
-    const uint16_t* first_encoding_table;
-    const uint16_t* index_to_second_table;
-    const uint16_t* second_encoding_table;
-    const uint8_t* kerning_values;
-};
-typedef struct _u8g2_kerning_t u8g2_kerning_t;
-
-struct u8g2_cb_struct {
-    u8g2_update_dimension_cb update_dimension;
-    u8g2_update_page_win_cb update_page_win;
-    u8g2_draw_l90_cb draw_l90;
-};
-
-typedef u8g2_uint_t (*u8g2_font_calc_vref_fnptr)(u8g2_t* u8g2);
-
-struct u8g2_struct {
-    u8x8_t u8x8;
-    u8g2_draw_ll_hvline_cb ll_hvline; 
-    const u8g2_cb_t* cb;
-    uint8_t*
-        tile_buf_ptr; 
-    uint8_t tile_buf_height;
-    uint8_t tile_curr_row;
-    u8g2_uint_t pixel_buf_width;
-    u8g2_uint_t pixel_buf_height;
-    u8g2_uint_t pixel_curr_row; 
-    u8g2_uint_t buf_y0;
-    u8g2_uint_t buf_y1;
-    u8g2_uint_t width;
-    u8g2_uint_t height;
-    u8g2_uint_t user_x0; 
-    u8g2_uint_t user_x1;
-    u8g2_uint_t user_y0;
-    u8g2_uint_t user_y1;
-    const uint8_t* font;
-    u8g2_font_calc_vref_fnptr font_calc_vref;
-    u8g2_font_decode_t font_decode; 
-    u8g2_font_info_t font_info; 
-    uint8_t font_height_mode;
-    int8_t font_ref_ascent;
-    int8_t font_ref_descent;
-    int8_t glyph_x_offset;
-    uint8_t bitmap_transparency;
-    uint8_t draw_color;
-    uint8_t is_auto_page_clear;
-};
 typedef struct EthViewProcessLine {
 typedef struct EthViewProcessLine {
     char data[SCREEN_SYMBOLS_WIDTH];
     char data[SCREEN_SYMBOLS_WIDTH];
 } EthViewProcessLine;
 } EthViewProcessLine;

+ 19 - 19
ethernet/eth_troubleshooter_app.c → ethernet/finik_eth_app.c

@@ -1,5 +1,5 @@
 
 
-#include "eth_troubleshooter_app.h"
+#include "finik_eth_app.h"
 
 
 #include <furi.h>
 #include <furi.h>
 #include <furi_hal_power.h>
 #include <furi_hal_power.h>
@@ -12,7 +12,7 @@
 #include "eth_worker_i.h"
 #include "eth_worker_i.h"
 #include "eth_view_process.h"
 #include "eth_view_process.h"
 
 
-#define TAG "EthTroubleshooterApp"
+#define TAG "FinikEthApp"
 
 
 static void draw_process_selector(Canvas* canvas, DrawProcess selector, CursorPosition cursor) {
 static void draw_process_selector(Canvas* canvas, DrawProcess selector, CursorPosition cursor) {
     uint8_t y = 0;
     uint8_t y = 0;
@@ -55,9 +55,9 @@ static void draw_battery_cunsumption(Canvas* canvas, double cons) {
     furi_string_free(string);
     furi_string_free(string);
 }
 }
 
 
-static void eth_troubleshooter_app_draw_callback(Canvas* canvas, void* ctx) {
+static void finik_eth_app_draw_callback(Canvas* canvas, void* ctx) {
     furi_assert(ctx);
     furi_assert(ctx);
-    EthTroubleshooterApp* app = ctx;
+    FinikEthApp* app = ctx;
 
 
     canvas_clear(canvas);
     canvas_clear(canvas);
 
 
@@ -82,28 +82,28 @@ static void eth_troubleshooter_app_draw_callback(Canvas* canvas, void* ctx) {
     }
     }
 }
 }
 
 
-static void eth_troubleshooter_battery_info_update_model(void* ctx) {
+static void finik_eth_battery_info_update_model(void* ctx) {
     furi_assert(ctx);
     furi_assert(ctx);
-    EthTroubleshooterApp* app = ctx;
+    FinikEthApp* app = ctx;
     power_get_info(app->power, &app->info);
     power_get_info(app->power, &app->info);
 }
 }
 
 
-static void eth_troubleshooter_app_input_callback(InputEvent* input_event, void* ctx) {
+static void finik_eth_app_input_callback(InputEvent* input_event, void* ctx) {
     furi_assert(ctx);
     furi_assert(ctx);
 
 
     FuriMessageQueue* event_queue = ctx;
     FuriMessageQueue* event_queue = ctx;
     furi_message_queue_put(event_queue, input_event, FuriWaitForever);
     furi_message_queue_put(event_queue, input_event, FuriWaitForever);
 }
 }
 
 
-EthTroubleshooterApp* eth_troubleshooter_app_alloc() {
-    EthTroubleshooterApp* app = malloc(sizeof(EthTroubleshooterApp));
+FinikEthApp* finik_eth_app_alloc() {
+    FinikEthApp* app = malloc(sizeof(FinikEthApp));
 
 
     app->view_port = view_port_alloc();
     app->view_port = view_port_alloc();
     app->event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
     app->event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
     app->eth_worker = eth_worker_alloc();
     app->eth_worker = eth_worker_alloc();
 
 
-    view_port_draw_callback_set(app->view_port, eth_troubleshooter_app_draw_callback, app);
-    view_port_input_callback_set(app->view_port, eth_troubleshooter_app_input_callback, app->event_queue);
+    view_port_draw_callback_set(app->view_port, finik_eth_app_draw_callback, app);
+    view_port_input_callback_set(app->view_port, finik_eth_app_input_callback, app->event_queue);
 
 
     app->gui = furi_record_open(RECORD_GUI);
     app->gui = furi_record_open(RECORD_GUI);
     gui_add_view_port(app->gui, app->view_port, GuiLayerFullscreen);
     gui_add_view_port(app->gui, app->view_port, GuiLayerFullscreen);
@@ -115,7 +115,7 @@ EthTroubleshooterApp* eth_troubleshooter_app_alloc() {
     return app;
     return app;
 }
 }
 
 
-void eth_troubleshooter_app_free(EthTroubleshooterApp* app) {
+void finik_eth_app_free(FinikEthApp* app) {
     furi_assert(app);
     furi_assert(app);
 
 
     view_port_enabled_set(app->view_port, false);
     view_port_enabled_set(app->view_port, false);
@@ -130,7 +130,7 @@ void eth_troubleshooter_app_free(EthTroubleshooterApp* app) {
     furi_record_close(RECORD_POWER);
     furi_record_close(RECORD_POWER);
 }
 }
 
 
-void eth_troubleshooter_app_key_handler(EthTroubleshooterApp* app, InputKey key) {
+void finit_eth_app_key_handler(FinikEthApp* app, InputKey key) {
     if(app->cursor_position == CURSOR_CHOOSE_PROCESS) {
     if(app->cursor_position == CURSOR_CHOOSE_PROCESS) {
         if(key == InputKeyUp || key == InputKeyDown) {
         if(key == InputKeyUp || key == InputKeyDown) {
             app->draw_process =
             app->draw_process =
@@ -176,19 +176,19 @@ void eth_troubleshooter_app_key_handler(EthTroubleshooterApp* app, InputKey key)
     }
     }
 }
 }
 
 
-int32_t eth_troubleshooter_app(void* p) {
+int32_t finik_eth_app(void* p) {
     UNUSED(p);
     UNUSED(p);
-    EthTroubleshooterApp* app = eth_troubleshooter_app_alloc();
+    FinikEthApp* app = finik_eth_app_alloc();
 
 
     InputEvent event;
     InputEvent event;
     uint8_t long_press = 0;
     uint8_t long_press = 0;
     InputKey long_press_key = 0;
     InputKey long_press_key = 0;
 
 
     while(1) {
     while(1) {
-        eth_troubleshooter_battery_info_update_model(app);
+        finik_eth_battery_info_update_model(app);
         if(furi_message_queue_get(app->event_queue, &event, 200) == FuriStatusOk) {
         if(furi_message_queue_get(app->event_queue, &event, 200) == FuriStatusOk) {
             if(event.type == InputTypePress) {
             if(event.type == InputTypePress) {
-                eth_troubleshooter_app_key_handler(app, event.key);
+                finit_eth_app_key_handler(app, event.key);
             } else if(event.type == InputTypeLong) {
             } else if(event.type == InputTypeLong) {
                 long_press = 1;
                 long_press = 1;
                 long_press_key = event.key;
                 long_press_key = event.key;
@@ -198,7 +198,7 @@ int32_t eth_troubleshooter_app(void* p) {
             }
             }
         }
         }
         if(long_press && long_press_key != InputKeyBack) {
         if(long_press && long_press_key != InputKeyBack) {
-            eth_troubleshooter_app_key_handler(app, long_press_key);
+            finit_eth_app_key_handler(app, long_press_key);
         }
         }
         if(app->cursor_position == CURSOR_EXIT) {
         if(app->cursor_position == CURSOR_EXIT) {
             eth_run(app->eth_worker, EthWorkerProcessExit);
             eth_run(app->eth_worker, EthWorkerProcessExit);
@@ -207,6 +207,6 @@ int32_t eth_troubleshooter_app(void* p) {
         view_port_update(app->view_port);
         view_port_update(app->view_port);
     }
     }
 
 
-    eth_troubleshooter_app_free(app);
+    finik_eth_app_free(app);
     return 0;
     return 0;
 }
 }

+ 3 - 3
ethernet/eth_troubleshooter_app.h → ethernet/finik_eth_app.h

@@ -6,7 +6,7 @@
 #include <power/power_service/power.h>
 #include <power/power_service/power.h>
 
 
 #include "eth_worker.h"
 #include "eth_worker.h"
-#include "eth_troubleshooter_icons.h"
+#include "finik_eth_icons.h"
 
 
 typedef enum {
 typedef enum {
     DRAW_ALL,
     DRAW_ALL,
@@ -31,7 +31,7 @@ typedef enum {
     CURSOR_EXIT,
     CURSOR_EXIT,
 } CursorPosition;
 } CursorPosition;
 
 
-struct EthTroubleshooterApp {
+struct FinikEthApp {
     Gui* gui;
     Gui* gui;
     ViewPort* view_port;
     ViewPort* view_port;
     FuriMessageQueue* event_queue;
     FuriMessageQueue* event_queue;
@@ -46,4 +46,4 @@ struct EthTroubleshooterApp {
     CursorPosition cursor_position;
     CursorPosition cursor_position;
 };
 };
 
 
-typedef struct EthTroubleshooterApp EthTroubleshooterApp;
+typedef struct FinikEthApp FinikEthApp;

BIN
ethernet/images/amperka_ru_logo_128x35px.png