Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skale negative weight fix #291

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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