Skip to content

Commit

Permalink
forcing write to complete
Browse files Browse the repository at this point in the history
  • Loading branch information
frux-c committed Mar 14, 2024
1 parent 4d8aae4 commit 36ab1db
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 2 additions & 9 deletions uhf_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,8 @@ M100ResponseType m100_write_label_data_storage(
cmd[cmd_length - 2] = checksum(cmd + 1, cmd_length - 3);
cmd[cmd_length - 1] = FRAME_END;
// send cmd
// furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, rx_callback, module->uart->buffer);
// furi_hal_uart_tx(FuriHalUartIdUSART1, cmd, cmd_length);
// unsigned int delay = DELAY_MS / 2;
// unsigned int timeout = 15;
// while(!buffer_get_size(module->uart->buffer)) {
// furi_delay_ms(delay);
// if(!timeout--) break;
// }
setup_and_send_rx(module, cmd, cmd_length);
M100ResponseType rp_type = setup_and_send_rx(module, cmd, cmd_length);
if(rp_type != M100SuccessResponse) return rp_type;
uint8_t* buff_data = uhf_buffer_get_data(module->uart->buffer);
size_t buff_length = uhf_buffer_get_size(module->uart->buffer);
if(buff_data[2] == 0xFF && buff_length == 8)
Expand Down
11 changes: 8 additions & 3 deletions uhf_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,20 @@ UHFWorkerEvent write_single_card(UHFWorker* uhf_worker) {
UHFTag* uhf_tag_des = send_polling_command(uhf_worker);
if(uhf_tag_des == NULL) return UHFWorkerEventAborted;
UHFTag* uhf_tag_from = uhf_worker->uhf_tag_wrapper->uhf_tag;
while(m100_set_select(uhf_worker->module, uhf_tag_des) != M100SuccessResponse){}
M100ResponseType rp_type;
do{
rp_type = m100_set_select(uhf_worker->module, uhf_tag_des);
if(uhf_worker->state == UHFWorkerStateStop) return UHFWorkerEventAborted;
if(rp_type == M100SuccessResponse) break;
}while(true);
do {
M100ResponseType rp_type = m100_write_label_data_storage(
rp_type = m100_write_label_data_storage(
uhf_worker->module, uhf_tag_from, uhf_tag_des, UserBank, 0, 0);
if(uhf_worker->state == UHFWorkerStateStop) return UHFWorkerEventAborted;
if(rp_type == M100SuccessResponse) break;
} while(true);
do {
M100ResponseType rp_type = m100_write_label_data_storage(
rp_type = m100_write_label_data_storage(
uhf_worker->module, uhf_tag_from, uhf_tag_des, EPCBank, 0, 0);
if(uhf_worker->state == UHFWorkerStateStop) return UHFWorkerEventAborted;
if(rp_type == M100SuccessResponse) break;
Expand Down

0 comments on commit 36ab1db

Please sign in to comment.