Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into mntm-dev
  • Loading branch information
Willy-JL committed Apr 5, 2024
2 parents ff7cb37 + 22cf19d commit e607147
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 38 deletions.
2 changes: 1 addition & 1 deletion applications/main/lfrfid/scenes/lfrfid_scene_save_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void lfrfid_scene_save_name_on_enter(void* context) {
LFRFID_TEXT_STORE_SIZE,
key_name_is_empty);

FURI_LOG_I("", "%s %s", furi_string_get_cstr(folder_path), app->text_store);
FURI_LOG_D("", "%s %s", furi_string_get_cstr(folder_path), app->text_store);

ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
furi_string_get_cstr(folder_path),
Expand Down
10 changes: 5 additions & 5 deletions applications/main/nfc/plugins/supported_cards/all_in_one.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ static AllInOneLayoutType all_in_one_get_layout(const MfUltralightData* data) {
const uint8_t layout_byte = data->page[5].data[2];
const uint8_t layout_half_byte = data->page[5].data[2] & 0x0F;

FURI_LOG_I(TAG, "Layout byte: %02x", layout_byte);
FURI_LOG_I(TAG, "Layout half-byte: %02x", layout_half_byte);
FURI_LOG_D(TAG, "Layout byte: %02x", layout_byte);
FURI_LOG_D(TAG, "Layout half-byte: %02x", layout_half_byte);

switch(layout_half_byte) {
// If it is A, the layout type is a type A layout
Expand All @@ -32,7 +32,7 @@ static AllInOneLayoutType all_in_one_get_layout(const MfUltralightData* data) {
case 0x02:
return AllInOneLayoutType2;
default:
FURI_LOG_I(TAG, "Unknown layout type: %d", layout_half_byte);
FURI_LOG_E(TAG, "Unknown layout type: %d", layout_half_byte);
return AllInOneLayoutTypeUnknown;
}
}
Expand All @@ -47,7 +47,7 @@ static bool all_in_one_parse(const NfcDevice* device, FuriString* parsed_data) {

do {
if(data->page[4].data[0] != 0x45 || data->page[4].data[1] != 0xD9) {
FURI_LOG_I(TAG, "Pass not verified");
FURI_LOG_E(TAG, "Pass not verified");
break;
}

Expand All @@ -63,7 +63,7 @@ static bool all_in_one_parse(const NfcDevice* device, FuriString* parsed_data) {
// If the layout is D, the ride count is stored in the second byte of page 9
ride_count = data->page[9].data[1];
} else {
FURI_LOG_I(TAG, "Unknown layout: %d", layout_type);
FURI_LOG_E(TAG, "Unknown layout: %d", layout_type);
ride_count = 137;
}

Expand Down
4 changes: 2 additions & 2 deletions applications/main/nfc/plugins/supported_cards/social_moscow.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void from_minutes_to_datetime(uint32_t minutes, DateTime* datetime, uint16_t sta
bool parse_transport_block(const MfClassicBlock* block, FuriString* result) {
uint16_t transport_departament = bit_lib_get_bits_16(block->data, 0, 10);

FURI_LOG_I(TAG, "Transport departament: %x", transport_departament);
FURI_LOG_D(TAG, "Transport departament: %x", transport_departament);

uint16_t layout_type = bit_lib_get_bits_16(block->data, 52, 4);
if(layout_type == 0xE) {
Expand All @@ -91,7 +91,7 @@ bool parse_transport_block(const MfClassicBlock* block, FuriString* result) {
layout_type = bit_lib_get_bits_16(block->data, 52, 14);
}

FURI_LOG_I(TAG, "Layout type %x", layout_type);
FURI_LOG_D(TAG, "Layout type %x", layout_type);

uint16_t card_view = 0;
uint16_t card_type = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ bool subghz_scene_frequency_analyzer_on_event(void* context, SceneManagerEvent e
return true;
} else if(event.event == SubGhzCustomEventViewFreqAnalOkLong) {
// Don't need to save, we already saved on short event
#ifdef FURI_DEBUG
FURI_LOG_W(TAG, "Goto next scene!");
#endif
//scene_manager_set_scene_state(subghz->scene_manager, SubGhzSceneStart, 10);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReceiver);
return true;
Expand Down
1 change: 1 addition & 0 deletions applications/main/subghz/scenes/subghz_scene_read_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ void subghz_scene_read_raw_on_enter(void* context) {

if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateBack) {
subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE);

if(furi_string_empty(file_name)) {
subghz_txrx_set_preset_internal(
subghz->txrx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ static void subghz_scene_receiver_config_var_list_enter_callback(void* context,
subghz->txrx,
SUBGHZ_LAST_SETTING_DEFAULT_FREQUENCY,
SUBGHZ_LAST_SETTING_DEFAULT_PRESET);

SubGhzSetting* setting = subghz_txrx_get_setting(subghz->txrx);
SubGhzRadioPreset preset = subghz_txrx_get_preset(subghz->txrx);
const char* preset_name = furi_string_get_cstr(preset.name);
Expand Down Expand Up @@ -445,6 +446,7 @@ static void subghz_scene_receiver_config_var_list_enter_callback(void* context,

variable_item_list_set_selected_item(subghz->variable_item_list, default_index);
variable_item_list_reset(subghz->variable_item_list);

subghz_last_settings_save(subghz->last_settings);

view_dispatcher_send_custom_event(
Expand Down Expand Up @@ -738,6 +740,7 @@ void subghz_scene_receiver_config_on_exit(void* context) {

variable_item_list_set_selected_item(subghz->variable_item_list, 0);
variable_item_list_reset(subghz->variable_item_list);

subghz_last_settings_save(subghz->last_settings);
scene_manager_set_scene_state(
subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerNoSet);
Expand Down
2 changes: 1 addition & 1 deletion applications/main/subghz/subghz_last_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define TAG "SubGhzLastSettings"

#define SUBGHZ_LAST_SETTING_FILE_TYPE "Flipper SubGhz Last Setting File"
#define SUBGHZ_LAST_SETTING_FILE_VERSION 2
#define SUBGHZ_LAST_SETTING_FILE_VERSION 3
#define SUBGHZ_LAST_SETTINGS_PATH EXT_PATH("subghz/assets/last_subghz.settings")

#define SUBGHZ_LAST_SETTING_FIELD_FREQUENCY "Frequency"
Expand Down
29 changes: 3 additions & 26 deletions applications/main/subghz/views/subghz_frequency_analyzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ uint32_t subghz_frequency_find_correct(uint32_t input) {
uint32_t prev_freq = 0;
uint32_t current = 0;
uint32_t result = 0;
#ifdef FURI_DEBUG
FURI_LOG_D(TAG, "input: %ld", input);
#endif

for(size_t i = 0; i < sizeof(subghz_frequency_list); i++) {
current = subghz_frequency_list[i];
if(current == input) {
Expand Down Expand Up @@ -281,17 +279,15 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
break;
}
subghz_frequency_analyzer_worker_set_trigger_level(instance->worker, trigger_level);
FURI_LOG_I(TAG, "trigger = %.1f", (double)trigger_level);
FURI_LOG_D(TAG, "trigger = %.1f", (double)trigger_level);
need_redraw = true;
} else if(event->type == InputTypePress && event->key == InputKeyUp) {
if(instance->feedback_level == 0) {
instance->feedback_level = 2;
} else {
instance->feedback_level--;
}
#ifdef FURI_DEBUG
FURI_LOG_D(TAG, "feedback_level = %d", instance->feedback_level);
#endif

need_redraw = true;
} else if(
((event->type == InputTypePress) || (event->type == InputTypeRepeat)) &&
Expand Down Expand Up @@ -324,13 +320,6 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
}
if(frequency_candidate > 0 &&
frequency_candidate != model->frequency_to_save) {
#ifdef FURI_DEBUG
FURI_LOG_D(
TAG,
"frequency_to_save: %ld, candidate: %ld",
model->frequency_to_save,
frequency_candidate);
#endif
model->frequency_to_save = frequency_candidate;
updated = true;
}
Expand Down Expand Up @@ -372,24 +361,12 @@ bool subghz_frequency_analyzer_input(InputEvent* event, void* context) {
},
true);

#ifdef FURI_DEBUG
FURI_LOG_I(
TAG,
"updated: %d, long: %d, type: %d",
updated,
(event->type == InputTypeLong),
event->type);
#endif

if(updated) {
instance->callback(SubGhzCustomEventViewFreqAnalOkShort, instance->context);
}

// First device receive short, then when user release button we get long
if(event->type == InputTypeLong && frequency_to_save > 0) {
#ifdef FURI_DEBUG
FURI_LOG_I(TAG, "Long press!");
#endif
// Stop worker
if(subghz_frequency_analyzer_worker_is_running(instance->worker)) {
subghz_frequency_analyzer_worker_stop(instance->worker);
Expand Down

0 comments on commit e607147

Please sign in to comment.