فهرست منبع

fix: hashtag symbol could not be found in encoding table

When getting the hashtag encoding, flipper format could not find the hashtag since flipper format ignores lines beginning with hashtag

fixes: #10
Alan Tsui 1 سال پیش
والد
کامیت
983451eabd
2فایلهای تغییر یافته به همراه11 افزوده شده و 3 حذف شده
  1. 1 1
      barcode_encoding_files/code128_encodings.txt
  2. 10 2
      barcode_validator.c

+ 1 - 1
barcode_encoding_files/code128_encodings.txt

@@ -1,7 +1,7 @@
  : 00
 !: 01
 ": 02
-#: 03
+H#: 03
 $: 04
 %: 05
 &: 06

+ 10 - 2
barcode_validator.c

@@ -273,8 +273,16 @@ void code_128_loader(BarcodeData* barcode_data) {
             char barcode_char = furi_string_get_char(barcode_data->raw_data, i);
 
             //convert a char into a string so it used in flipper_format_read_string
-            char current_character[2];
-            snprintf(current_character, 2, "%c", barcode_char);
+            char current_character[3];
+            snprintf(current_character, 3, "%c", barcode_char);
+
+            /* 
+            Checks if the character is a hashtag, if it is change the character from # to H#
+            Github Issue: #10
+            */
+            if(strcmp("#", current_character) == 0) {
+                strcpy(current_character, "H#");
+            }
 
             //get the value of the character
             if(!flipper_format_read_string(ff, current_character, value)) {