fix: add code for miscale_v2 lbs (#1029)
This commit is contained in:
1 parent
e56b4336c2
commit
910ff91d08
1 file changed
+10
-1
+10
-1
@@ -1466,7 +1466,16 @@ JsonObject& process_scale_v1(JsonObject& BLEdata) {
|
|||||||
JsonObject& process_scale_v2(JsonObject& BLEdata) {
|
JsonObject& process_scale_v2(JsonObject& BLEdata) {
|
||||||
const char* servicedata = BLEdata["servicedata"].as<const char*>();
|
const char* servicedata = BLEdata["servicedata"].as<const char*>();
|
||||||
|
|
||||||
double weight = (double)value_from_hex_data(servicedata, 22, 4, true) / 200;
|
double weight = 0;
|
||||||
|
if (servicedata[1] == '2') { //kg
|
||||||
|
weight = (double)value_from_hex_data(servicedata, 22, 4, true) / 200;
|
||||||
|
BLEdata.set("unit", "kg");
|
||||||
|
} else if (servicedata[1] == '3') { //lbs
|
||||||
|
weight = (double)value_from_hex_data(servicedata, 22, 4, true) / 100;
|
||||||
|
BLEdata.set("unit", "lbs");
|
||||||
|
} else { //unknown unit
|
||||||
|
BLEdata.set("unit", "unknown");
|
||||||
|
}
|
||||||
double impedance = (double)value_from_hex_data(servicedata, 18, 4, true);
|
double impedance = (double)value_from_hex_data(servicedata, 18, 4, true);
|
||||||
|
|
||||||
//Set Json values
|
//Set Json values
|
||||||
|
|||||||
Reference in new issue
Block a user