edit log file encoding for wiegand_load compatibility

This commit is contained in:
Xavier 2023-11-21 17:50:33 -05:00
parent d43bc66305
commit d9f9ccae08

View File

@ -30,6 +30,7 @@ void ensure_dir_exists(Storage *storage)
FURI_LOG_I(TAG, "Directory exists: %s", WIEGAND_SAVE_FOLDER); FURI_LOG_I(TAG, "Directory exists: %s", WIEGAND_SAVE_FOLDER);
} }
} }
void wiegand_save(void *context) void wiegand_save(void *context)
{ {
App *app = context; App *app = context;
@ -52,8 +53,21 @@ void wiegand_save(void *context)
storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer)); storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer));
furi_string_printf(buffer, "Bits: %d\n", bit_count); furi_string_printf(buffer, "Bits: %d\n", bit_count);
storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer)); storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer));
furi_string_printf(buffer, "PACS_Binary: "); furi_string_printf(buffer, "RAW_Data: ");
for (int i = 0; i < bit_count; i++)
{
furi_string_cat_printf(
buffer,
"D%d %ld %ld ",
data[i] ? 1 : 0,
data_fall[i] - data_fall[0],
data_rise[i] - data_fall[0]);
}
furi_string_push_back(buffer, '\n');
storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer));
furi_string_printf(buffer, "PACS_Binary: ");
for (int i = 0; i < bit_count; i++) for (int i = 0; i < bit_count; i++)
{ {
furi_string_cat_printf(buffer, "%d", data[i] ? 1 : 0); furi_string_cat_printf(buffer, "%d", data[i] ? 1 : 0);
@ -71,7 +85,6 @@ void wiegand_save(void *context)
furi_string_cat_printf(buffer, " --ki 0\n"); furi_string_cat_printf(buffer, " --ki 0\n");
storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer)); storage_file_write(data_file, furi_string_get_cstr(buffer), furi_string_size(buffer));
storage_file_close(data_file); storage_file_close(data_file);
} }
@ -137,4 +150,4 @@ bool wiegand_save_scene_on_event(void *context, SceneManagerEvent event)
break; break;
} }
return consumed; return consumed;
} }