Skip to content

Commit

Permalink
Skale negative weight fix (#291)
Browse files Browse the repository at this point in the history
Skale negative weight fix with possible negative weight through Tare

Co-authored-by: Cadsters <26138119+Cadsters@users.noreply.github.com>
  • Loading branch information
DigiH and Cadsters authored Feb 20, 2023
1 parent f3fc898 commit c290efc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/devices/Skale_json.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const char* _Skale_json = "{\"brand\":\"Atomax\",\"model\":\"Skale I/II\",\"model_id\":\"SKALE\",\"tag\":\"0501\",\"condition\":[\"manufacturerdata\",\"=\",12,\"index\",0,\"ef81\"],\"properties\":{\"weight\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",4,4,true,false],\"post_proc\":[\"/\",10]}}}";
const char* _Skale_json = "{\"brand\":\"Atomax\",\"model\":\"Skale I/II\",\"model_id\":\"SKALE\",\"tag\":\"0501\",\"condition\":[\"manufacturerdata\",\"=\",12,\"index\",0,\"ef81\"],\"properties\":{\"weight\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",4,4,true,true],\"post_proc\":[\"/\",10]}}}";
/*R""""(
{
"brand":"Atomax",
Expand All @@ -8,7 +8,7 @@ const char* _Skale_json = "{\"brand\":\"Atomax\",\"model\":\"Skale I/II\",\"mode
"condition":["manufacturerdata", "=", 12, "index", 0, "ef81"],
"properties":{
"weight":{
"decoder":["value_from_hex_data", "manufacturerdata", 4, 4, true, false],
"decoder":["value_from_hex_data", "manufacturerdata", 4, 4, true, true],
"post_proc":["/", 10]
}
}
Expand Down
3 changes: 3 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const char* expected_mfg[] = {
"{\"brand\":\"Polar\",\"model\":\"Heart Rate Sensor\",\"model_id\":\"H10\",\"type\":\"BODY\",\"bpm\":104}",
"{\"brand\":\"Atomax\",\"model\":\"Skale I/II\",\"model_id\":\"SKALE\",\"type\":\"SCALE\",\"cidc\":false,\"weight\":123.9}",
"{\"brand\":\"Atomax\",\"model\":\"Skale I/II\",\"model_id\":\"SKALE\",\"type\":\"SCALE\",\"cidc\":false,\"weight\":29.6}",
"{\"brand\":\"Atomax\",\"model\":\"Skale I/II\",\"model_id\":\"SKALE\",\"type\":\"SCALE\",\"cidc\":false,\"weight\":-92.8}",
};

const char* expected_name_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -381,6 +382,7 @@ const char* test_mfgdata[][3] = {
{"Polar", "Polar H10 75087320", "6b002f166b68"},
{"Atomax", "Skale I/II", "ef81d70400ff"},
{"Atomax", "Skale I/II", "ef81280100ff"},
{"Atomax", "Skale I/II", "ef8160fcffff"},
};

TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
Expand Down Expand Up @@ -473,6 +475,7 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::PH10,
TheengsDecoder::BLE_ID_NUM::SKALE,
TheengsDecoder::BLE_ID_NUM::SKALE,
TheengsDecoder::BLE_ID_NUM::SKALE,
};

// uuid test input [test name] [device name] [uuid] [manufacturer data] [service data]
Expand Down

0 comments on commit c290efc

Please sign in to comment.