1
0
mirror of https://github.com/halleysfifthinc/Toyota-AVC-LAN synced 2025-06-07 16:06:12 +00:00

Rename HexInc -> incBCD; comment out unused decrement functions

This commit is contained in:
Allen Hill 2023-08-06 20:52:29 -04:00
parent 66633db24e
commit 241b7cf50a
2 changed files with 22 additions and 26 deletions

View File

@ -833,9 +833,9 @@ byte AVCLan_Command(byte command)
return r; return r;
} }
// DONE: Nothing needed. /* Increment packed 2-digit BCD number.
//------------------------------------------------------------------------------ WARNING: Overflow behavior is incorrect (e.g. `incBCD(0x99) != 0x00`) */
byte HexInc(byte data) byte incBCD(byte data)
{ {
if ((data & 0x9)==0x9) if ((data & 0x9)==0x9)
return (data + 7); return (data + 7);
@ -843,28 +843,24 @@ byte HexInc(byte data)
return (data+1); return (data+1);
} }
// DONE: Nothing needed. // /* Decrement packed 2-digit BCD number */
//------------------------------------------------------------------------------ // byte decBCD(byte data)
byte HexDec(byte data) // {
{ // if ((data & 0xF)==0)
if ((data & 0xF)==0) // return (data - 7);
return (data - 7);
return (data-1); // return (data-1);
} // }
// DONE: Nothing needed. // /* convert 8-bit binary to packed 2-digit BCD */
//------------------------------------------------------------------------------ // byte bin2BCD8(byte data)
// encode decimal valute to 'toyota' format :-) // {
// ex. 42 (dec) = 0x42 (toy) // byte d,d1;
byte Dec2Toy(byte data) // d = (unsigned int)data/(unsigned int)10;
{ // d1 = d * 16;
byte d,d1; // d = d1 + (data - 10*d);
d = (unsigned int)data/(unsigned int)10; // return d;
d1 = d * 16; // }
d = d1 + (data - 10*d);
return d;
}
// DONE: No timing adjustment needed. // DONE: No timing adjustment needed.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -109,9 +109,9 @@ byte AVCLan_SendAnswer();
byte AVCLan_SendDataBroadcast(); byte AVCLan_SendDataBroadcast();
byte AVCLan_Command(byte command); byte AVCLan_Command(byte command);
byte HexInc(byte data); byte incBCD(byte data);
byte HexDec(byte data); // byte decBCD(byte data); // unused
byte Dec2Toy(byte data); // byte bin2BCD8(byte data);
extern byte check_timeout; extern byte check_timeout;