Closed baettigp closed 6 months ago
@baettigp what is the purpose of having to pass the type of the scale into the init() function, if the scale type is already determined inside init() by attempting to subscribe to READ_CHAR_FELICITA?
I t was a way to remove the last remaining #ifdef in the library for the getname functions. I didn't figure out how to unite them (avais name strings are all 5 bytes, felicita is 8).
I thought it easier then have the user go into the library file and change a line; to have him pass his (known) scale in the sketch...
What would be a better possibility for this? (Also in view to extend the library to further scales, decent, difluid, ..., I now see that my solution would be limited to avais and felicita)
I only check the first 5 characters of the name of the scale since the rest of them are often serialized. I'll do the same for the Felicita and just check if the substring is "FELIC"
I found the cause of the tare bug:
( _type == OLD || NEW ? TARE_ACAIA : TARE_FELICITA)
always returns TARE_ACAIA
since NEW
is always non-zero AKA TRUE
as an argument for the ||
operator. I'll go ahead and switch that around so you won't need two tare commands.
Appreciate you finding these issues!
Hi Tate The library can now be called from the arduino sketch directly by uncommenting any of the following: //acaia.init("ACAIA","##:##:##:##:##:##"); //acaia.init("FELICITA_ARC","##:##:##:##:##:##"); acaia.init("FELICITA_ARC"); //acaia.init("ACAIA");
so the user does not have to go and change a #define in the cpp file of the library. For some reason, the felicita arc likes to be sent its tare command twice(and only one byte), so I added that into the tare function. I hope that doesn't break any of the Acaia code :)
Best regards,
Pio