iButton, RFID: rc-59 fixes (#1291)

* iButton: correct rename logic
* LFRFID: remove debug info, correct text
This commit is contained in:
SG 2022-06-02 22:56:03 +10:00 committed by GitHub
parent b625e84424
commit 40e3df9979
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 18 deletions

View file

@ -211,11 +211,12 @@ bool ibutton_save_key(iButton* ibutton, const char* key_name) {
bool result = false;
do {
// First remove key if it was saved (we rename the key)
ibutton_delete_key(ibutton);
// Set full file name, for new key
// Check if we has old key
if(string_end_with_str_p(ibutton->file_path, IBUTTON_APP_EXTENSION)) {
// First remove old key
ibutton_delete_key(ibutton);
// Remove old key name from path
size_t filename_start = string_search_rchar(ibutton->file_path, '/');
string_left(ibutton->file_path, filename_start);
}

View file

@ -81,7 +81,7 @@ void LfRfidAppSceneReadSuccess::on_enter(LfRfidApp* app, bool /* need_restore */
case LfrfidKeyType::KeyIoProxXSF:
line_1_text->set_text("HEX:", 65, 23, 0, AlignRight, AlignBottom, FontSecondary);
line_2l_text->set_text("FC:", 65, 35, 0, AlignRight, AlignBottom, FontSecondary);
line_2r_text->set_text("V:", 95, 35, 0, AlignRight, AlignBottom, FontSecondary);
line_2r_text->set_text("VС:", 95, 35, 0, AlignRight, AlignBottom, FontSecondary);
line_3_text->set_text("Card:", 65, 47, 0, AlignRight, AlignBottom, FontSecondary);
for(uint8_t i = 0; i < app->worker.key.get_type_data_count(); i++) {

View file

@ -1,23 +1,10 @@
#include "lfrfid_app_scene_save_data.h"
#include <dolphin/dolphin.h>
static void print_buffer(const uint8_t* buffer) {
for(uint8_t i = 0; i < LFRFID_KEY_SIZE; i++) {
printf("%02X", buffer[i]);
}
}
void LfRfidAppSceneSaveData::on_enter(LfRfidApp* app, bool need_restore) {
auto byte_input = app->view_controller.get<ByteInputVM>();
RfidKey& key = app->worker.key;
printf("k: ");
print_buffer(key.get_data());
printf(" o: ");
print_buffer(old_key_data);
printf(" n: ");
print_buffer(new_key_data);
printf("\r\n");
if(need_restore) printf("restored\r\n");
if(need_restore) {