tatemazer / AcaiaArduinoBLE

Acaia Scale Gateway using the ArduinoBLE library for devices such as the esp32 and other Bluetooth-enabled Arduino compatible hardware.
MIT License
40 stars 6 forks source link

Added Felicita Arc Suport #3

Closed baettigp closed 6 months ago

baettigp commented 6 months ago

Hi Tate Please find here the modifications for the Felicita Arc to your library. I added the relevant code paths via #ifdef so the user needs to define them according to the scale they own; I am not sure whether one could determine the type via the connection type earlier and then make a switch Scale_type -case Acaia -case Felicita Arc or if Scaletype == ... then.. else. But for me, the scale now connects and returns a stream of weight measurements, sign works for the Felicita. Battery level is not (yet) implemented.

The Felicita Arc does not need a heartbeat to stay connected, thus I added the #define FELICITA_ARC in the bare_minimum sketch as well.

The thing that stopped me for several days, was that I was subscribing to ffe0 instead of ffe1, as pointed out by Graphefruit...

I hope this is helpful to you and the community.

Best regards

Pio Baettig

I asked on kaffee-netz and home barista whether someone could check my mods to the code with their Felicita Arc/Acaia but have not gotten any answer (so far) :)

https://www.kaffee-netz.de/threads/felicita-arc-bluetooth-arduino.156533/ https://www.home-barista.com/repairs/felicita-arc-ble-scale-and-arduino-t92237.html


Scale Interface test Starting init Searching for FELICITA Arc FELICITA FELICITA FELICITA Connecting ... Connected Discovering attributes ... Attributes discovered 1 ffe0 Felicita Arc Detected Peripheral Characteristics set Felicita subscribed! identify write successful notification request write successful 0.00 0.00 0.00 0.00 0.00 3.90 64.10 180.30 281.50 304.70

tatemazer commented 6 months ago

Awesome Pio, thanks again!

Do you think it would be possible to automatically detect the scale, in a similar way I did to detect which version of the acaia it sees? Ideally I'd keep this pretty much plug-and-play, with minimal configuration required.

If you think you can get something like that working (sadly I don't have Felicita scale on me) I'll go ahead and regression test on my end with my acaia and then merge.

baettigp commented 6 months ago

Hi

I updated the h and the cpp files and managed to remove most all the ifdefs, only one is left in the .cpp:

ifdef ACAIA

bool AcaiaArduinoBLE::isAcaiaName(String name){ String nameShort = name.substring(0,5);

return nameShort == "CINCO"
    || nameShort == "ACAIA"
    || nameShort == "PYXIS"
    || nameShort == "LUNAR"
    || nameShort == "PROCH";

}

endif

ifdef FELICITA_ARC

bool AcaiaArduinoBLE::isAcaiaName(String name){ String nameShort = name.substring(0,8); Serial.println("FELICITA"); return nameShort == "FELICITA"; }

endif

where I don't know how to deal with the different lenghts of the names, maybe you have an idea how to resolve this?

I integrated your newest version (negative weights also for acaia) and my felicita arc is detected and works. The felicita doesn't need a heartbeat so I also put in a check if _type==old||new or else return 0 so the heartbeat never gets called for felicita. I hope it still works with your acaia! :)