Merge branch 'Eng1n33r:dev' into 420

This commit is contained in:
RogueMaster
2022-10-06 20:15:45 -04:00
committed by GitHub
4 changed files with 17 additions and 19 deletions

View File

@@ -16,7 +16,7 @@ void nfc_scene_mfkey_nonces_info_on_enter(void* context) {
uint16_t nonces_saved = mfkey32_get_auth_sectors(temp_str); uint16_t nonces_saved = mfkey32_get_auth_sectors(temp_str);
widget_add_text_scroll_element(nfc->widget, 0, 22, 128, 42, furi_string_get_cstr(temp_str)); widget_add_text_scroll_element(nfc->widget, 0, 22, 128, 42, furi_string_get_cstr(temp_str));
furi_string_printf(temp_str, "Nonce pairs saved %d", nonces_saved); furi_string_printf(temp_str, "Nonce pairs saved: %d", nonces_saved);
widget_add_string_element( widget_add_string_element(
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(temp_str)); nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, furi_string_get_cstr(temp_str));
widget_add_string_element( widget_add_string_element(

View File

@@ -13,7 +13,7 @@
#define SUBGHZ_HISTORY_TMP_EXTENSION ".tmp" #define SUBGHZ_HISTORY_TMP_EXTENSION ".tmp"
#define SUBGHZ_HISTORY_TMP_SIGNAL_MAX_LEVEL_DURATION 700 #define SUBGHZ_HISTORY_TMP_SIGNAL_MAX_LEVEL_DURATION 700
#define SUBGHZ_HISTORY_TMP_SIGNAL_MIN_LEVEL_DURATION 100 #define SUBGHZ_HISTORY_TMP_SIGNAL_MIN_LEVEL_DURATION 100
#define SUBGHZ_HISTORY_TMP_REMOVE_FILES false #define SUBGHZ_HISTORY_TMP_REMOVE_FILES true
#define SUBGHZ_HISTORY_TMP_RAW_KEY "RAW_Data" #define SUBGHZ_HISTORY_TMP_RAW_KEY "RAW_Data"
#define TAG "SubGhzHistory" #define TAG "SubGhzHistory"
@@ -52,8 +52,7 @@ struct SubGhzHistory {
FuriString* subghz_history_generate_temp_filename(uint32_t index) { FuriString* subghz_history_generate_temp_filename(uint32_t index) {
FuriHalRtcDateTime datetime = {0}; FuriHalRtcDateTime datetime = {0};
furi_hal_rtc_get_datetime(&datetime); furi_hal_rtc_get_datetime(&datetime);
FuriString* filename = furi_string_alloc_printf("%03d%s", index, SUBGHZ_HISTORY_TMP_EXTENSION); return furi_string_alloc_printf("%03d%s", index, SUBGHZ_HISTORY_TMP_EXTENSION);
return filename;
} }
bool subghz_history_is_tmp_dir_exists(SubGhzHistory* instance) { bool subghz_history_is_tmp_dir_exists(SubGhzHistory* instance) {
@@ -103,7 +102,7 @@ void subghz_history_clear_tmp_dir(SubGhzHistory* instance) {
// Nothing to do here! // Nothing to do here!
return; return;
} }
uint32_t start_time = furi_get_tick(); //uint32_t start_time = furi_get_tick();
#ifdef SUBGHZ_HISTORY_TMP_REMOVE_FILES #ifdef SUBGHZ_HISTORY_TMP_REMOVE_FILES
// Stage 0 - Dir exists? // Stage 0 - Dir exists?
bool res = subghz_history_is_tmp_dir_exists(instance); bool res = subghz_history_is_tmp_dir_exists(instance);
@@ -123,8 +122,8 @@ void subghz_history_clear_tmp_dir(SubGhzHistory* instance) {
FURI_LOG_E(TAG, "Cannot process temp dir!"); FURI_LOG_E(TAG, "Cannot process temp dir!");
} }
#endif #endif
uint32_t stop_time = furi_get_tick() - start_time; /* uint32_t stop_time = furi_get_tick() - start_time;
FURI_LOG_I(TAG, "Running time (clear_tmp_dir): %d ms", stop_time); FURI_LOG_I(TAG, "Running time (clear_tmp_dir): %d ms", stop_time);*/
} }
SubGhzHistory* subghz_history_alloc(void) { SubGhzHistory* subghz_history_alloc(void) {
@@ -237,11 +236,9 @@ FlipperFormat* subghz_history_get_raw_data(SubGhzHistory* instance, uint16_t idx
bool result_ok = false; bool result_ok = false;
if(instance->write_tmp_files && item->is_file) { if(instance->write_tmp_files && item->is_file) {
// We have files! // We have files!
FuriString* filename; FuriString* filename = subghz_history_generate_temp_filename(idx);
FuriString* dir_path; FuriString* dir_path;
filename = furi_string_alloc();
dir_path = furi_string_alloc();
filename = subghz_history_generate_temp_filename(idx);
dir_path = furi_string_alloc_printf( dir_path = furi_string_alloc_printf(
"%s/%s", SUBGHZ_HISTORY_TMP_DIR, furi_string_get_cstr(filename)); "%s/%s", SUBGHZ_HISTORY_TMP_DIR, furi_string_get_cstr(filename));
@@ -353,8 +350,8 @@ bool subghz_history_add_to_history(
FURI_LOG_E(TAG, "Missing Protocol"); FURI_LOG_E(TAG, "Missing Protocol");
break; break;
} else { } else {
item->protocol_name = furi_string_printf(
furi_string_alloc_printf("%s", furi_string_get_cstr(instance->tmp_string)); item->protocol_name, "%s", furi_string_get_cstr(instance->tmp_string));
} }
if(!strcmp(furi_string_get_cstr(instance->tmp_string), "RAW")) { if(!strcmp(furi_string_get_cstr(instance->tmp_string), "RAW")) {
furi_string_printf( furi_string_printf(
@@ -414,12 +411,10 @@ bool subghz_history_add_to_history(
// If we can write to files // If we can write to files
if(instance->write_tmp_files && tmp_file_for_raw) { if(instance->write_tmp_files && tmp_file_for_raw) {
FuriString* filename; FuriString* filename = subghz_history_generate_temp_filename(instance->last_index_write);
FuriString* dir_path; FuriString* dir_path;
filename = furi_string_alloc();
dir_path = furi_string_alloc(); dir_path = furi_string_alloc();
filename = subghz_history_generate_temp_filename(instance->last_index_write);
furi_string_cat_printf( furi_string_cat_printf(
dir_path, "%s/%s", SUBGHZ_HISTORY_TMP_DIR, furi_string_get_cstr(filename)); dir_path, "%s/%s", SUBGHZ_HISTORY_TMP_DIR, furi_string_get_cstr(filename));
#ifdef FURI_DEBUG #ifdef FURI_DEBUG

View File

@@ -209,6 +209,11 @@ static void bt_hid_keyboard_draw_callback(Canvas* canvas, void* context) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15); canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
canvas_set_font(canvas, FontPrimary); canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keyboard"); elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keyboard");
canvas_draw_icon(canvas, 68, 3, &I_Pin_back_arrow_10x8);
canvas_set_font(canvas, FontSecondary);
elements_multiline_text_aligned(canvas, 127, 4, AlignRight, AlignTop, "Hold to exit");
elements_multiline_text_aligned( elements_multiline_text_aligned(
canvas, 4, 60, AlignLeft, AlignBottom, "Waiting for Connection..."); canvas, 4, 60, AlignLeft, AlignBottom, "Waiting for Connection...");
return; // Dont render the keyboard if we are not yet connected return; // Dont render the keyboard if we are not yet connected

View File

@@ -91,9 +91,7 @@ void mfkey32_set_callback(Mfkey32* instance, Mfkey32ParseDataCallback callback,
} }
static bool mfkey32_write_params(Mfkey32* instance, Mfkey32Params* params) { static bool mfkey32_write_params(Mfkey32* instance, Mfkey32Params* params) {
FuriString* str; FuriString* str = furi_string_alloc_printf(
str = furi_string_alloc_printf(
"Sec %d key %c cuid %08x nt0 %08x nr0 %08x ar0 %08x nt1 %08x nr1 %08x ar1 %08x\n", "Sec %d key %c cuid %08x nt0 %08x nr0 %08x ar0 %08x nt1 %08x nr1 %08x ar1 %08x\n",
params->sector, params->sector,
params->key == MfClassicKeyA ? 'A' : 'B', params->key == MfClassicKeyA ? 'A' : 'B',