From 955cb86fc14d605fa17f5c4bed882c09a2a945cb Mon Sep 17 00:00:00 2001 From: I12BP8 Date: Fri, 24 Apr 2026 12:02:35 -0400 Subject: [PATCH] Fix barcode checksum to include prefix letter Pricer barcodes validate with (sum of all 17 chars) mod 10 == 0, with the letter prefix contributing by its ASCII offset from '0'. The old formula compared sum of the first 16 digits to the 17th, rejecting valid codes like A4120365539013704. --- protocol/tagtinker_proto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/tagtinker_proto.c b/protocol/tagtinker_proto.c index e463268..5daa110 100644 --- a/protocol/tagtinker_proto.c +++ b/protocol/tagtinker_proto.c @@ -286,8 +286,8 @@ void tagtinker_free_image_payload(TagTinkerImagePayload* payload) { bool tagtinker_is_barcode_valid(const char* barcode) { if(!barcode || strlen(barcode) != 17) return false; - int cs = 0; for(int i = 0; i < 16; i++) cs += (int)(barcode[i] - '0'); - return ((cs % 10) == (barcode[16] - '0')); + int cs = 0; for(int i = 0; i < 17; i++) cs += (int)(barcode[i] - '0'); + return (cs % 10) == 0; } size_t tagtinker_make_addressed_frame(uint8_t* buf, const uint8_t plid[4], const uint8_t* payload, size_t len) {