Skip to content

Commit

Permalink
replace protoview pa table hotfix with proper code
Browse files Browse the repository at this point in the history
by thedroidgeek in protoview repo in PR 15
  • Loading branch information
xMasterX committed Aug 15, 2023
1 parent 2b62870 commit 25842ee
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions signal_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,21 @@ bool save_signal(ProtoViewApp* app, const char* filename) {
custom,
"Custom_preset_module: CC1101\n"
"Custom_preset_data: ");
for(int j = 0; regs[j]; j += 2) {

/* We will know the size of the preset data once we reach the end
* of the registers (null address). For now it's INT_MAX. */
int preset_data_size = INT_MAX;
bool patable_reached = false;
for(int j = 0; j <= preset_data_size; j += 2) {
// End reached, set the size to write the remaining 8 bytes (PATABLE)
if(!patable_reached && regs[j] == 0) {
preset_data_size = j + 8;
patable_reached = true;
}
furi_string_cat_printf(custom, "%02X %02X ", (int)regs[j], (int)regs[j + 1]);
}
// Add patable
furi_string_cat(custom, "00 00 C0 00 00 00 00 00 00 00 ");
//size_t len = furi_string_size(file_content);
//furi_string_set_char(custom, len - 1, '\n');
furi_string_cat(custom, "\n");
size_t len = furi_string_size(custom);
furi_string_set_char(custom, len - 1, '\n');
furi_string_cat(file_content, custom);
furi_string_free(custom);
}
Expand Down

0 comments on commit 25842ee

Please sign in to comment.