# HG changeset patch # User Mychaela Falconia # Date 1583392155 0 # Node ID 6e442ed0f64d2392cb3729f3ded9432a1fb27ef5 # Parent 24d7d7875ee995932fb2820ec981969a5c621417 frbl/reconst/convert.c: perfect match to TCS211 object diff -r 24d7d7875ee9 -r 6e442ed0f64d frbl/reconst/convert.c --- a/frbl/reconst/convert.c Thu Mar 05 06:38:36 2020 +0000 +++ b/frbl/reconst/convert.c Thu Mar 05 07:09:15 2020 +0000 @@ -2,7 +2,7 @@ #include "convert.h" static SYS_UWORD8 *bss_0; -static SYS_UWORD32 bss_4; +static enum {NO_STRING, IN_STRING} bss_4; static SYS_UWORD16 bss_8; static SYS_UWORD8 bss_0xa; static SYS_UWORD32 bss_0xc; @@ -10,10 +10,10 @@ long con_get_command_from_string(SYS_UWORD8 byte_to_analyze, SYS_UWORD8 *command) { - long sp8 = 0; + long command_built = 0; switch (bss_4) { - case 0: + case NO_STRING: /* 0x10 */ if (byte_to_analyze == 0xAA) { /* 0x18 */ @@ -21,15 +21,15 @@ } else { /* 0x26 */ if (bss_0xc == 0) - return (sp8); + break; bss_0 = command + 1; bss_0xa = 0; bss_8 = byte_to_analyze; bss_0xc = 0; - bss_4 = 1; + bss_4 = IN_STRING; } - return (sp8); - case 1: + break; + case IN_STRING: /* 0x52 */ if (byte_to_analyze == 0xAA) { /* 0x5a */ @@ -59,17 +59,17 @@ /* 0xbc */ bss_8--; if (bss_8) - return (sp8); + break; *command = bss_0xa; - sp8 = 1; - bss_0xc = bss_4 = 0; + command_built = 1; + bss_4 = NO_STRING; + bss_0xc = 0; /* FLUID hack */ if (command[0] == 0x01 && command[1] == 0xDD) fluid_bootloader(); /* end FLUID hack */ - return (sp8); } - return (sp8); + return command_built; } void @@ -100,6 +100,6 @@ void con_initialize_conversion(void) { - bss_4 = 0; + bss_4 = NO_STRING; bss_0xc = 0; }