From b5472a1a99661e31295a14f305407b6c0f9f57e6 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Wed, 24 Apr 2024 09:56:34 +0800 Subject: [PATCH] =?utf8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E4=BA=A7=E6=B5=8B?= =?utf8?q?=E6=B5=81=E7=A8=8B=EF=BC=8Cabout=EF=BC=8Cgsensor=EF=BC=8C=20mags?= =?utf8?q?ensor=202=E3=80=81cywee=E4=BC=98=E5=8C=96=EF=BC=8C=E9=87=87?= =?utf8?q?=E7=94=A8=E4=B8=AD=E6=96=AD=E8=AF=BB=E5=8F=96=E6=95=B0=E6=8D=AE?= =?utf8?q?=203=E3=80=81ppg=E5=92=8Cmag=20service=20=E6=A0=B9=E6=8D=AE?= =?utf8?q?=E8=AE=BE=E5=A4=87=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E5=86=B3?= =?utf8?q?=E5=AE=9A=E6=98=AF=E5=90=A6=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1?= =?utf8?q?=204=E3=80=81cat1=20=E6=89=80=E6=9C=89timer=E5=A4=84=E7=90=86?= =?utf8?q?=E7=A7=BB=E5=88=B0timer=E4=B8=AD=E6=96=AD=E5=A4=96=E6=89=A7?= =?utf8?q?=E8=A1=8C=E3=80=82=205=E3=80=81acc=20=E9=87=87=E7=94=A8float?= =?utf8?q?=E6=95=B0=E6=8D=AE=E8=BF=9B=E8=A1=8C=E4=BC=A0=E8=BE=93=E5=8F=8A?= =?utf8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/producttest/include/testabout.h | 28 +- .../nativeui/producttest/src/testabout.cpp | 450 +++++++++++------- .../nativeui/producttest/src/testgsenson.cpp | 15 +- .../nativeui/producttest/src/testmagnetic.cpp | 14 +- .../nativeui/producttest/src/testold.cpp | 8 +- .../brandy_evb/board_config/board_evb.h | 6 +- .../drivers/peripheral/cywee/Inc/cywee_hal.h | 9 +- .../peripheral/cywee/service/cywee_service.c | 3 +- .../drivers/peripheral/cywee/src/main_dml.c | 106 ++--- .../peripheral/mag/service/mag_service.c | 27 +- .../drivers/peripheral/ppg/hx3695/hx3695.c | 2 +- .../peripheral/ppg/service/ppg_service.cpp | 28 +- .../peripheral/slip/cat1Service/cat1_ctl.cpp | 3 +- .../slip/cat1Service/cat1_server.cpp | 18 +- .../peripheral/utils/custom_cmd_service.c | 6 +- .../drivers/peripheral/utils/custom_utils.c | 18 +- .../drivers/peripheral/utils/custom_utils.h | 4 +- 17 files changed, 457 insertions(+), 288 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h index 8eb5cdad6..872c18927 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h @@ -27,7 +27,7 @@ namespace OHOS int16_t height; int16_t fontSize; // 字体大小 int16_t lineHeigh; // 行高 - char *text; // 文本 + std::string text; // 文本 uint8_t lineBreakMode; // 断行模式。 }; UIScrollView *SystemAbouTheWatchtInitIView(void); @@ -39,17 +39,21 @@ namespace OHOS private: bool testAboutTheWatchScrollViewinit(void); UIScrollView *testAboutTheWatchScrollView{nullptr}; - UILabel *SystemAboutTheWatchTitle{nullptr}; // “关于” - UILabel *WatchNameTitle{nullptr}; // “手表名称” - UILabel *WatchName{nullptr}; - UILabel *FirmwareVersionTitle{nullptr}; // "固件版本" - UILabel *FirmwareVersion{nullptr}; - UILabel *AlgorithmVersionTitle{nullptr}; // “算法版本” - UILabel *AlgorithmVersion{nullptr}; - UILabel *BluetoothAddressTitle{nullptr}; // “蓝牙地址” - UILabel *BluetoothAddress{nullptr}; - UILabel *LANAddressTitle{nullptr}; // “局域网地址” - UILabel *LANAddress = nullptr; + UILabel *SystemAboutTheWatchTitle{nullptr}; // "关于" + UILabel *WatchNameTitle{nullptr}; // "手表名称Title" + UILabel *WatchName{nullptr}; // "手表名称" + UILabel *FirmwareVersionTitle{nullptr}; // "固件版本Title" + UILabel *FirmwareVersion{nullptr}; // "固件版本" + UILabel *BluetoothNameTitle{nullptr}; // "蓝牙名称Title" + UILabel *BluetoothName{nullptr}; // "蓝牙名称" + UILabel *BluetoothAddressTitle{nullptr}; // "蓝牙地址Title" + UILabel *BluetoothAddress{nullptr}; // "蓝牙地址" + UILabel *Network4GTitle{nullptr}; // "4G ModemTitle" + UILabel *Network4G{nullptr}; // "4G Modem" + UILabel *PyVerTitle{nullptr}; // "pyVerTitle" + UILabel *PyVer{nullptr}; // "pyVer" + UILabel *IMELTitle{nullptr}; // "IMELTitle" + UILabel *IMEL{nullptr}; // "IMELTitle" UILabel *FONTTitle = nullptr; UILabel *FONT = nullptr; UILabelButtonExt* labelButton_next = nullptr; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp index b70fd37b2..240916185 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp @@ -2,9 +2,53 @@ #include "custom_utils.h" #include "producttest/include/testPresenter.h" #include "producttest/include/testabout.h" +#include "config/include/ConfigModel.h" + + + + +#define WATCH_ABOUT_TITLE_HEIGHT 50 +#define WATCH_ABOUT_VALUE_HEIGHT 80 +#define WATCH_NAME_POS_TOP 160 +#define WATCH_NAME_VALUE_POS_TOP (WATCH_NAME_POS_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_FIRMWARE_POS_TOP (WATCH_NAME_VALUE_POS_TOP + WATCH_ABOUT_VALUE_HEIGHT) +#define WATCH_FIRMWARE_VALUE_POS_TOP (WATCH_FIRMWARE_POS_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_BT_NAME_TOP (WATCH_FIRMWARE_VALUE_POS_TOP + WATCH_ABOUT_VALUE_HEIGHT) +#define WATCH_BT_NAME_VALUE_TOP (WATCH_BT_NAME_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_BT_ADDR_TOP (WATCH_BT_NAME_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT) +#define WATCH_BT_ADDR_VALUE_TOP (WATCH_BT_ADDR_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_MODEM_VERSION_TOP (WATCH_BT_ADDR_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT) +#define WATCH_MODEM_VERSION_VALUE_TOP (WATCH_MODEM_VERSION_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_MODEM_APP_VERSION_TOP (WATCH_MODEM_VERSION_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT) +#define WATCH_MODEM_APP_VERSION_VALUE_TOP (WATCH_MODEM_APP_VERSION_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_IMEI_TOP (WATCH_MODEM_APP_VERSION_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT) +#define WATCH_IMEI_VALUE_TOP (WATCH_IMEI_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_FONT_TOP (WATCH_IMEI_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT) +#define WATCH_FONT_VALUE_TOP (WATCH_FONT_TOP + WATCH_ABOUT_TITLE_HEIGHT) +#define WATCH_ABOUT_NEXT_BUTTON_TOP (WATCH_FONT_VALUE_TOP + WATCH_ABOUT_VALUE_HEIGHT) namespace OHOS { + static constexpr uint16_t SYSTEM_ABOUT_THEWATCH_TITLE_X = 93; + static constexpr uint16_t SYSTEM_ABOUT_THEWATCH_TITLE_Y = 52; + static constexpr uint16_t SYSTEM_ABOUT_THEWATCH_TITLE_W = 280; + static constexpr uint16_t SYSTEM_ABOUT_THEWATCH_TITLE_H = 40; + static constexpr uint16_t SYSTEM_ABOUT_THEWATCH_TITLE_FONTSIZE = 30; + static constexpr uint16_t SYSTEM_ABOUT_THEWATCH_TITLE_LINEHEIGHT = 35; + + static constexpr uint16_t TITLE_LABEL_X = 53; + static constexpr uint16_t TITLE_LABEL_W = 360; + static constexpr uint16_t TITLE_LABEL_H = 40; + static constexpr uint16_t TITLE_LABEL_FONTSIZE = 30; + static constexpr uint16_t TITLE_LABEL_LINEHEIGHT = 35; + + static constexpr uint16_t LABEL_X = 33; + static constexpr uint16_t LABEL_W = 400; + static constexpr uint16_t LABEL_H = 40; + static constexpr uint16_t LABEL_FONTSIZE = 30; + static constexpr uint16_t LABEL_LINEHEIGHT = 35; + + static testAboutView g_pSystemAboutTheWatchView; testAboutView::testAboutView() @@ -33,32 +77,47 @@ namespace OHOS testAboutTheWatchScrollView->RemoveAll(); delete SystemAboutTheWatchTitle; SystemAboutTheWatchTitle = nullptr; + delete WatchNameTitle; WatchNameTitle = nullptr; delete WatchName; WatchName = nullptr; + delete FirmwareVersionTitle; FirmwareVersionTitle = nullptr; delete FirmwareVersion; FirmwareVersion = nullptr; - delete AlgorithmVersionTitle; - AlgorithmVersionTitle = nullptr; - delete AlgorithmVersion; - AlgorithmVersion = nullptr; + + delete BluetoothNameTitle; + BluetoothNameTitle = nullptr; + delete BluetoothName; + BluetoothName = nullptr; + delete BluetoothAddressTitle; BluetoothAddressTitle = nullptr; delete BluetoothAddress; BluetoothAddress = nullptr; - delete LANAddressTitle; - LANAddressTitle = nullptr; - delete LANAddress; - LANAddress = nullptr; + + delete Network4GTitle; + Network4GTitle = nullptr; + delete Network4G; + Network4G = nullptr; + + delete PyVerTitle; + PyVerTitle = nullptr; + delete PyVer; + PyVer = nullptr; + + delete IMELTitle; + IMELTitle = nullptr; + delete IMEL; + IMEL = nullptr; + delete FONTTitle; FONTTitle = nullptr; delete FONT; FONT = nullptr; - delete labelButton_next; - labelButton_next=nullptr; + delete testAboutTheWatchScrollView; testAboutTheWatchScrollView = nullptr; } @@ -124,7 +183,7 @@ namespace OHOS label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小 label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize); // 字体大小 label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh); // 字体行高 - label->SetText(labelConfig.text); // 内容 + label->SetText(labelConfig.text.c_str()); // 内容 label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。 label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP); label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelConfig.fontSize); @@ -166,266 +225,337 @@ namespace OHOS } /* -------------------------------------------------------------------------- */ LabelConfig Config = { - .left = 203, - .top = 52, - .width = 60, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, + .left = SYSTEM_ABOUT_THEWATCH_TITLE_X, + .top = SYSTEM_ABOUT_THEWATCH_TITLE_Y, + .width = SYSTEM_ABOUT_THEWATCH_TITLE_W, + .height = SYSTEM_ABOUT_THEWATCH_TITLE_H, + .fontSize = SYSTEM_ABOUT_THEWATCH_TITLE_FONTSIZE, + .lineHeigh = SYSTEM_ABOUT_THEWATCH_TITLE_LINEHEIGHT, .text = "关于", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; SystemAboutTheWatchTitle = InitLabel(Config); if (SystemAboutTheWatchTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchTitle new fail!"); return nullptr; } testAboutTheWatchScrollView->Add(SystemAboutTheWatchTitle); /* -------------------------------------------------------------------------- */ Config = { - .left = 173, - .top = 160, - .width = 120, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, + .left = TITLE_LABEL_X, + .top = WATCH_NAME_POS_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, .text = "手表名称", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; WatchNameTitle = InitLabel(Config); if (WatchNameTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchNameTitle new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::WatchNameTitle new fail!"); return nullptr; } testAboutTheWatchScrollView->Add(WatchNameTitle); /* -------------------------------------------------------------------------- */ Config = { - .left = 37, - .top = 216, - .width = 400, - .height = 30, - .fontSize = 26, - .lineHeigh = 30, + .left = LABEL_X, + .top = WATCH_NAME_VALUE_POS_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE, + .lineHeigh = LABEL_LINEHEIGHT, .text = "Watch Soar", - .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; WatchName = InitLabel(Config); if (WatchName == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchName new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::WatchName new fail!"); return nullptr; } - WatchName->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + WatchName->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); testAboutTheWatchScrollView->Add(WatchName); /* -------------------------------------------------------------------------- */ Config = { - .left = 173, - .top = 305, - .width = 120, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, + .left = TITLE_LABEL_X, + .top = WATCH_FIRMWARE_POS_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, .text = "固件版本", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; FirmwareVersionTitle = InitLabel(Config); if (FirmwareVersionTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FirmwareVersionTitle new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FirmwareVersionTitle new fail!"); return nullptr; } testAboutTheWatchScrollView->Add(FirmwareVersionTitle); /* -------------------------------------------------------------------------- */ - char version_buf[128]={0}; - uint32_t version_len=128; - uapi_get_buildversion((uint8_t*)version_buf,version_len); + char version_buf[128] = {0}; + uint32_t version_len = 128; + uapi_get_buildversion((uint8_t *)version_buf, version_len); Config = { - .left = 37, - .top = 341, - .width = 400, - .height = 30, - .fontSize = 26, - .lineHeigh = 30, - .text = (char*)version_buf, + .left = LABEL_X, + .top = WATCH_FIRMWARE_VALUE_POS_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE, + .lineHeigh = LABEL_LINEHEIGHT, + .text = (char *)version_buf, .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; FirmwareVersion = InitLabel(Config); if (FirmwareVersion == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FirmwareVersion new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FirmwareVersion new fail!"); return nullptr; } - FirmwareVersion->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + FirmwareVersion->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); testAboutTheWatchScrollView->Add(FirmwareVersion); /* -------------------------------------------------------------------------- */ Config = { - .left = 173, - .top = 450, - .width = 120, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, - .text = "算法版本", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .left = TITLE_LABEL_X, + .top = WATCH_BT_NAME_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, + .text = "蓝牙名称", + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; - AlgorithmVersionTitle = InitLabel(Config); - if (AlgorithmVersionTitle == nullptr) + BluetoothNameTitle = InitLabel(Config); + if (BluetoothNameTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::AlgorithmVersionTitle new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::BluetoothNameTitle new fail!"); return nullptr; } - testAboutTheWatchScrollView->Add(AlgorithmVersionTitle); + testAboutTheWatchScrollView->Add(BluetoothNameTitle); /* -------------------------------------------------------------------------- */ + uint8_t ble_name[LABEL_FONTSIZE] = {0}; + uint32_t ble_name_len = sizeof(ble_name); + errcode_t ret = uapi_get_nv_btname(ble_name, &ble_name_len); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get btname %s ,ret 0x%X\n", ble_name, ret); + Config = { - .left = 37, - .top = 506, - .width = 400, - .height = 30, - .fontSize = 26, - .lineHeigh = 30, - .text = "V02.03.01 OTA88", - .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + .left = LABEL_X, + .top = WATCH_BT_NAME_VALUE_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE, + .lineHeigh = LABEL_LINEHEIGHT, + .text = (char *)ble_name, + .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; - AlgorithmVersion = InitLabel(Config); - if (AlgorithmVersion == nullptr) + BluetoothName = InitLabel(Config); + if (BluetoothName == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::AlgorithmVersion new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::BluetoothName new fail!"); return nullptr; } - AlgorithmVersion->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); - testAboutTheWatchScrollView->Add(AlgorithmVersion); + BluetoothName->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); + testAboutTheWatchScrollView->Add(BluetoothName); /* -------------------------------------------------------------------------- */ Config = { - .left = 173, - .top = 595, - .width = 120, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, + .left = TITLE_LABEL_X, + .top = WATCH_BT_ADDR_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, .text = "蓝牙地址", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; BluetoothAddressTitle = InitLabel(Config); if (BluetoothAddressTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BluetoothAddressTitle new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::BluetoothAddressTitle new fail!"); return nullptr; } testAboutTheWatchScrollView->Add(BluetoothAddressTitle); /* -------------------------------------------------------------------------- */ - uint8_t btaddr[6] ={0}; - uint8_t btaddr_str[64]={0}; - uint32_t len = 64; - errcode_t ret = uapi_get_nv_btaddr((uint8_t*)btaddr,&len); - sprintf((char*)btaddr_str , "%02X:%02X:%02X:%02X:%02X:%02X",btaddr[0],btaddr[1],btaddr[2],btaddr[3],btaddr[4],btaddr[5]); + uint8_t btaddr[6] = {0}; + uint8_t btaddr_str[64] = {0}; + uint32_t len = 6; + ret = uapi_get_nv_btaddr((uint8_t *)btaddr, &len); + sprintf((char *)btaddr_str, "%02X:%02X:%02X:%02X:%02X:%02X", btaddr[0], btaddr[1], btaddr[2], btaddr[3], btaddr[4], btaddr[5]); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"get btaddr %s , ret 0x%X\n",btaddr_str,ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get btaddr %s , ret 0x%X\n", btaddr_str, ret); Config = { - .left = 37, - .top = 651, - .width = 400, - .height = 30, - .fontSize = 26, - .lineHeigh = 30, - .text = "", - .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + .left = LABEL_X, + .top = WATCH_BT_ADDR_VALUE_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE, + .lineHeigh = LABEL_LINEHEIGHT, + .text = (char *)btaddr_str, + .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; - Config.text = (char*)btaddr_str; - BluetoothAddress = InitLabel(Config); if (BluetoothAddress == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BluetoothAddress new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::BluetoothAddress new fail!"); return nullptr; } - BluetoothAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + BluetoothAddress->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); testAboutTheWatchScrollView->Add(BluetoothAddress); /* -------------------------------------------------------------------------- */ Config = { - .left = 173, - .top = 740, - .width = 120, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, - .text = "蓝牙名称", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .left = TITLE_LABEL_X, + .top = WATCH_MODEM_VERSION_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, + .text = "4G Modem", + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; - LANAddressTitle = InitLabel(Config); - if (LANAddressTitle == nullptr) + Network4GTitle = InitLabel(Config); + if (Network4GTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddressTitle new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::Network4GTitle new fail!"); return nullptr; } - testAboutTheWatchScrollView->Add(LANAddressTitle); + testAboutTheWatchScrollView->Add(Network4GTitle); /* -------------------------------------------------------------------------- */ - - uint8_t ble_name[20] = {0}; - uint32_t ble_name_len ; - ret = uapi_get_nv_btname(ble_name, &ble_name_len); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"get btname %s ,ret 0x%X\n",ble_name,ret); - Config = { - .left = 37, - .top = 796, - .width = 400, - .height = 30, - .fontSize = 26, - .lineHeigh = 30, - .text ="", - .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + .left = LABEL_X, + .top = WATCH_MODEM_VERSION_VALUE_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE - 2, + .lineHeigh = LABEL_LINEHEIGHT, + .text = ConfigModel::GetInstance()->GetmoderVer(), + .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; - Config.text = (char*)ble_name; - LANAddress = InitLabel(Config); - if (LANAddress == nullptr) + Network4G = InitLabel(Config); + if (Network4G == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BTNAME new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::Network4G new fail!"); return nullptr; } - LANAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); - testAboutTheWatchScrollView->Add(LANAddress); + Network4G->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(Network4G); /* -------------------------------------------------------------------------- */ Config = { - .left = 173, - .top = 885, - .width = 120, - .height = 35, - .fontSize = 30, - .lineHeigh = 35, + .left = TITLE_LABEL_X, + .top = WATCH_MODEM_APP_VERSION_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, + .text = "pyVer", + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + }; + PyVerTitle = InitLabel(Config); + if (PyVerTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::PyVerTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(PyVerTitle); + /* -------------------------------------------------------------------------- */ + Config = { + .left = LABEL_X, + .top = WATCH_MODEM_APP_VERSION_VALUE_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE, + .lineHeigh = LABEL_LINEHEIGHT, + .text = ConfigModel::GetInstance()->GetpyVer(), + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + PyVer = InitLabel(Config); + if (PyVer == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::PyVer new fail!"); + return nullptr; + } + PyVer->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(PyVer); + /* -------------------------------------------------------------------------- */ + Config = { + .left = TITLE_LABEL_X, + .top = WATCH_IMEI_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, + .text = "IMEI", + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + }; + IMELTitle = InitLabel(Config); + if (IMELTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::IMELTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(IMELTitle); + /* -------------------------------------------------------------------------- */ + Config = { + .left = LABEL_X, + .top = WATCH_IMEI_VALUE_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, + .text = ConfigModel::GetInstance()->Getimei(), + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + IMEL = InitLabel(Config); + if (IMEL == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::IMEL new fail!"); + return nullptr; + } + IMEL->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(IMEL); + /* -------------------------------------------------------------------------- */ + Config = { + .left = TITLE_LABEL_X, + .top = WATCH_FONT_TOP, + .width = TITLE_LABEL_W, + .height = TITLE_LABEL_H, + .fontSize = TITLE_LABEL_FONTSIZE, + .lineHeigh = TITLE_LABEL_LINEHEIGHT, .text = "FONTS", - .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, }; FONTTitle = InitLabel(Config); if (FONTTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FONTTitle new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FONTTitle new fail!"); return nullptr; } testAboutTheWatchScrollView->Add(FONTTitle); /* -------------------------------------------------------------------------- */ Config = { - .left = 37, - .top = 941, - .width = 400, - .height = 30, - .fontSize = 26, - .lineHeigh = 30, + .left = LABEL_X, + .top = WATCH_FONT_VALUE_TOP, + .width = LABEL_W, + .height = LABEL_H, + .fontSize = LABEL_FONTSIZE, + .lineHeigh = LABEL_LINEHEIGHT, .text = "HarmonyOS Sans", - .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; - LANAddress = InitLabel(Config); - if (LANAddress == nullptr) + FONT = InitLabel(Config); + if (FONT == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddress new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FONT new fail!"); return nullptr; } - LANAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); - testAboutTheWatchScrollView->Add(LANAddress); + FONT->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(FONT); + /* -------------------------------------------------------------------------- */ initViewStatus = true; - labelButton_next =init_button_next(165, 960,"LCDButton_next"); + labelButton_next =init_button_next(165, WATCH_ABOUT_NEXT_BUTTON_TOP,"LCDButton_next"); testAboutTheWatchScrollView->Add(labelButton_next); return testAboutTheWatchScrollView; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp index 04746cec0..4b72fa42a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp @@ -2,7 +2,6 @@ #include "custom_utils.h" #include "producttest/include/testPresenter.h" #include "producttest/include/testgsenson.h" -#include "mag_service.h" #include "cmsis_os2.h" #include "cywee_hal.h" //#include "acc_service.h" @@ -57,6 +56,7 @@ namespace OHOS testGsonsonScrollView->RemoveAll(); if (Gsenson_TEST_timer != NULL) { + osTimerStop(Gsenson_TEST_timer); osTimerDelete(Gsenson_TEST_timer); Gsenson_TEST_timer = NULL; return ; @@ -94,10 +94,10 @@ namespace OHOS gsenson_t t; get_gsonsen_xyz(&t); char buf[124]={0}; - uint16 x_t=t.x; - uint16 y_t=t.y; - uint16 z_t=t.z; - sprintf(buf,"X:%d\nY:%d\nZ:%d",x_t,y_t,z_t); + float x_t=t.x; + float y_t=t.y; + float z_t=t.z; + sprintf(buf,"X:%.2f\nY:%.2f\nZ:%.2f",x_t,y_t,z_t); x->SetText(buf); RootView::GetInstance()->Invalidate(); @@ -191,11 +191,10 @@ namespace OHOS } testGsonsonScrollView->Add(title); /* -------------------------------------------------------------------------- */ - uint16_t angle_value= (int16_t)mag_service_get_fAzimuth(); gsenson_t t; - //get_gsonsen_xyz(&t); + // get_gsonsen_xyz(&t); char buf[124]={0}; - sprintf(buf,"X:%f\nY:%f\nZ:%f",t.x,t.y,t.z); + sprintf(buf,"X:%.2f\nY:%.2f\nZ:%.2f",t.x,t.y,t.z); Config = { .left = 173, .top = 160, diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp index d5b1d9c23..68bbef825 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp @@ -38,13 +38,15 @@ namespace OHOS if(testmagicScrollView) { testmagicScrollView->RemoveAll(); - +#ifndef TEST_BATTERY + CompassModel::GetInstance()->CloseCompassSensor(); +#endif if (magneyic_TEST_timer != NULL) { + osTimerStop(magneyic_TEST_timer); osTimerDelete(magneyic_TEST_timer); magneyic_TEST_timer = NULL; return ; } - if(title!=NULL) { delete title; @@ -95,14 +97,12 @@ namespace OHOS RootView::GetInstance()->Invalidate(); #else MG_TEST_FALG++; - uint16_t angle_value= (int16_t)mag_service_get_fAzimuth(); + float angle_value= mag_service_get_fAzimuth(); char buf[16]={0}; - sprintf(buf,"angle:%d",angle_value); + sprintf(buf,"angle:%.2f",angle_value); x->SetText(buf); RootView::GetInstance()->Invalidate(); - if(MG_TEST_FALG>10) - CompassModel::GetInstance()->CloseCompassSensor(); #endif } @@ -195,7 +195,7 @@ namespace OHOS .height = 35, .fontSize = 20, #else - .left = 173, + .left = 86, .top = 160, .width = 120, .height = 35, diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp index f5de4b2fb..9996b769a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp @@ -57,10 +57,10 @@ namespace OHOS gsenson_t t; get_gsonsen_xyz(&t); char buf[64]={0}; - uint16 x_t=t.x; - uint16 y_t=t.y; - uint16 z_t=t.z; - sprintf(buf,"gsensor:\nX:%d\nY:%d\nZ:%d",x_t,y_t,z_t); + float x_t=t.x; + float y_t=t.y; + float z_t=t.z; + sprintf(buf,"gsensor:\nX:%.2f\nY:%.2f\nZ:%.2f",x_t,y_t,z_t); if(AGING_task_falg && testoldView::GetInstance()) { testoldView::GetInstance()->setbuf(buf); diff --git a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h index f707f3427..190af85f9 100755 --- a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h +++ b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h @@ -243,7 +243,7 @@ const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = { //默认开启Cat1 然后再根据配置决定是否关闭. -#define DEFAULT_POWERON_CAT1 1 +#define DEFAULT_POWERON_CAT1 0 //需要配置默认输出的,以及需要配置默认输入中断函数的。 const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = { @@ -291,14 +291,14 @@ const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = { #ifdef ENABLE_CYWEE /**G sensor G_INT1 S_AGPIO_L11 G_INT2 S_AGPIO_L19*/ //{ S_AGPIO_L11, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, GPIO_INTERRUPT_RISING_EDGE, cywee_int1_callback }, - { S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, GPIO_INTERRUPT_RISING_EDGE, cywee_int1_callback }, + // { S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_HIGH, GPIO_INTERRUPT_RISING_EDGE, cywee_int1_callback }, // { S_AGPIO_L19, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, 0, NULL }, #endif /**S_AGPIO_R1 GPO alipay默认resetpin*/ { S_AGPIO_R1, HAL_GPIO_DIRECTION_OUTPUT, HAL_GPIO_LEVEL_HIGH, 0, NULL }, #ifdef SUPPORT_CAT1_SERVICE /**cat1 ring input key*/ - { S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_LOW, GPIO_INTERRUPT_DEDGE, cat1_ring_isr_callback}, + // { S_AGPIO_L31, HAL_GPIO_DIRECTION_INPUT, HAL_GPIO_LEVEL_HIGH, GPIO_INTERRUPT_DEDGE, cat1_ring_isr_callback}, #endif }; /** diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index 8fbb26024..f91ff783c 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -128,12 +128,9 @@ typedef struct }set_activity_mode_t; typedef struct { - uint16_t x; - uint16_t y; - uint16_t z; - // uint16_t x_1; - // uint16_t y_1; - // uint16_t z_1; + float x; + float y; + float z; } gsenson_t; #if 1 diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index f2c3affff..27f6eb282 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -213,7 +213,6 @@ static void cywee_service_check_timer_callback(void *data) if (cywee_service_running_stat == true) { do_cywee_service_check_msg(CYWEE_SERVICE_CMD_TIMER_CHECK, NULL); - // cywee_service_timer_start_check(CYWEE_CHECK_MS); } } void uapi_cywee_service_deinit(void) @@ -401,7 +400,7 @@ errcode_t uapi_cywee_service_init(void) void cywee_int1_callback(pin_t pin, uintptr_t param) { - PRINT("cywee_int1_callback %d 0x%X\n",pin,param); + // PRINT("cywee_int1_callback %d 0x%X\n",pin,param); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_TIMER_CHECK, NULL); } diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 8795eb6ce..a4325f545 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -307,40 +307,34 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { case IDX_ACCEL: #if 1 - CWM_OS_dbgPrintf("acc: x=%.3f, y=%.3f, z=%.3f\n", - sensorEVT->fData[0], - sensorEVT->fData[1], - sensorEVT->fData[2] - ); - s_data[i][0] = sensorEVT->fData[0]; - s_data[i][1] = sensorEVT->fData[1]; - s_data[i][2] = sensorEVT->fData[2]; - i++; - if(i == 24) - i = 0; - // if(num_falg==8) - // { - // left_falg++; - // right_falg++; - // right_falg=right_falg%8; - // left_falg=left_falg%8; - // gxyz_t_queue[right_falg].x= sensorEVT->fData[0]; - // gxyz_t_queue[right_falg].y= sensorEVT->fData[1]; - // gxyz_t_queue[right_falg].z= sensorEVT->fData[2]; - // } - // else - // { - // //left_falg++; - // right_falg++; - // right_falg=right_falg%8; - // //left_falg=left_falg%16; - // num_falg++; - // gxyz_t_queue[right_falg].x= sensorEVT->fData[0]; - // gxyz_t_queue[right_falg].y= sensorEVT->fData[1]; - // gxyz_t_queue[right_falg].z= sensorEVT->fData[2]; - // //CWM_OS_dbgPrintf("write: x=%d, y=%d, z=%d\n", gxyz_t_queue[right_falg].x ,gxyz_t_queue[right_falg].y ,gxyz_t_queue[right_falg].z); - - // } + // CWM_OS_dbgPrintf("acc: x=%.3f, y=%.3f, z=%.3f\n", + // sensorEVT->fData[0], + // sensorEVT->fData[1], + // sensorEVT->fData[2] + // ); + if(num_falg==8) + { + left_falg++; + right_falg++; + right_falg=right_falg%8; + left_falg=left_falg%8; + gxyz_t_queue[right_falg].x= sensorEVT->fData[0]; + gxyz_t_queue[right_falg].y= sensorEVT->fData[1]; + gxyz_t_queue[right_falg].z= sensorEVT->fData[2]; + } + else + { + //left_falg++; + right_falg++; + right_falg=right_falg%8; + //left_falg=left_falg%16; + num_falg++; + gxyz_t_queue[right_falg].x= sensorEVT->fData[0]; + gxyz_t_queue[right_falg].y= sensorEVT->fData[1]; + gxyz_t_queue[right_falg].z= sensorEVT->fData[2]; + //CWM_OS_dbgPrintf("write: x=%d, y=%d, z=%d\n", gxyz_t_queue[right_falg].x ,gxyz_t_queue[right_falg].y ,gxyz_t_queue[right_falg].z); + + } #endif break; @@ -767,19 +761,16 @@ int cywee_main_dml(void) scl.iData[8] = 52; // for st sensor(52Hz) #else scl.iData[3] = 2; - scl.iData[4] = 2; //1 anytime 2 fifo + scl.iData[4] = 1; //1 anytime 2 fifo scl.iData[6] = 25; //fifocount 先設定5 [1~25] - scl.iData[8] = 25; // for st sensor(52Hz) + scl.iData[8] = 26; // for st sensor(52Hz) //scl.iData[11] = 1; // G_INT_1 - scl.iData[12] = 1; // G_INT_1 + scl.iData[12] = 4; // G_INT_1 #endif CWM_SettingControl(SCL_DML_DRV_AG_CONFIG, &scl); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - CWM_CustomSensorInput_Fifo_Init(25); - - //设定搜寻哪种型号的传感器,以及要搜寻的属性 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; @@ -901,24 +892,25 @@ int cywee_main_dml(void) void cywee_int_handler(void) { - uint64_t ts_ns =CWM_OS_GetTimeNs(); + // uint64_t ts_ns =CWM_OS_GetTimeNs(); - int ret = CWM_CustomSensorInput_Fifo_Start(CUSTOM_ACC, ts_ns , 40*1e6); - CWM_OS_dbgPrintf("cywee_int_handler ts_seconds %d , CWM_CustomSensorInput_Fifo_Start ret 0x%X \r\n",ts_ns,ret); - if (ret == 0 ) - { - for (int i = 0; i < 25; i ++) - { - memset(&csd, 0, sizeof(CustomSensorData)); - csd.sensorType = CUSTOM_ACC; - csd.fData[0] = s_data[i][0]; - csd.fData[1] = s_data[i][1]; - csd.fData[2] = s_data[i][2]; - CWM_CustomSensorInput(&csd); - } + // int ret = CWM_CustomSensorInput_Fifo_Start(CUSTOM_ACC, ts_ns , 40*1e6); + // CWM_OS_dbgPrintf("cywee_int_handler ts_seconds %d , CWM_CustomSensorInput_Fifo_Start ret 0x%X \r\n",ts_ns,ret); + // if (ret == 0 ) + // { + // for (int i = 0; i < 25; i ++) + // { + // memset(&csd, 0, sizeof(CustomSensorData)); + // csd.sensorType = CUSTOM_ACC; + // csd.fData[0] = s_data[i][0]; + // csd.fData[1] = s_data[i][1]; + // csd.fData[2] = s_data[i][2]; + // CWM_CustomSensorInput(&csd); + // } - } - CWM_CustomSensorInput_Fifo_End(CUSTOM_ACC); + // } + // CWM_CustomSensorInput_Fifo_End(CUSTOM_ACC); - ret = CWM_Dml_process(); + // ret = CWM_Dml_process(); + CWM_Dml_process(); } diff --git a/code/sdk/drivers/peripheral/mag/service/mag_service.c b/code/sdk/drivers/peripheral/mag/service/mag_service.c index 43e9da5f1..23ed1d94a 100644 --- a/code/sdk/drivers/peripheral/mag/service/mag_service.c +++ b/code/sdk/drivers/peripheral/mag/service/mag_service.c @@ -78,6 +78,8 @@ static bool g_batter_service_initialled = false; osTimerId_t g_mag_service_timer = NULL; +static bool g_mag_sensor_exist = false; + static bool g_bat_timer_is_running = false; #define MAG_CHECK_MS 20 static unsigned long g_app_queue; @@ -88,8 +90,12 @@ static void mag_service_check_timer_callback(void* data); static void mag_service_timer_start_check(uint32_t rtc_ms) { - if (g_bat_timer_is_running ) osTimerStop(g_mag_service_timer); - if (mag_service_running_stat == true) osTimerStart(g_mag_service_timer, rtc_ms); + if (g_bat_timer_is_running ) + osTimerStop(g_mag_service_timer); + + if (mag_service_running_stat == true) + osTimerStart(g_mag_service_timer, rtc_ms); + g_bat_timer_is_running = true; } @@ -125,7 +131,8 @@ void uapi_mag_service_deinit(void) void do_mag_service_check_msg(int cmd) { int ret; - + if (g_mag_sensor_exist == false) + return ; common_notify_mail_t mail = {0}; mail.comm.app = cmd; ret = osal_msg_queue_write_copy(g_app_queue, (void *)&mail, @@ -142,8 +149,6 @@ static void mag_service_check_task(void const *arg) int32_t ret; common_notify_mail_t mail; uint32_t msgsize = (uint32_t)sizeof(common_notify_mail_t); - MMC5603_CheckID(); - mmc5603_stop(); while (1) { ret = osal_msg_queue_read_copy(g_app_queue, (void *)&mail, &msgsize, OSAL_MSGQ_WAIT_FOREVER); @@ -184,6 +189,18 @@ errcode_t uapi_mag_service_init(void) PRINT("uapi_mag_service_init !\r\n"); + + + + if(MMC5603_CheckID()!=1) + { + //TODO 设置磁力计检测是否存在标识 + PRINT("MMC5603 not found!\r\n"); + return ERRCODE_FAIL; + } + mmc5603_stop(); + g_mag_sensor_exist = true; + app_task_definition_t taskcfg={0}; taskcfg.create_queue_handle = create_mag_queue; taskcfg.attr.name="mag_service"; diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 35bf6695c..8f69c3422 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2783,7 +2783,7 @@ void hx3695_hrs_ppg_Int_handle(void) gsen_fifo_y_send[ii] = gsensordata[ii].y; gsen_fifo_z_send[ii] = gsensordata[ii].z; } - PRINT("hxdata:%d/%d %d %d %d %d %d %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsen_fifo_x_send[ii],gsen_fifo_y_send[ii],gsen_fifo_z_send[ii],ppg_s_data.green_cur); + PRINT("hxdata:%d/%d %d %d %.2f %.2f %.2f %d\r\n" ,1+ii,*count,PPG_buf[ii],ir_buf[0],gsen_fifo_x_send[ii],gsen_fifo_y_send[ii],gsen_fifo_z_send[ii],ppg_s_data.green_cur); } hrs_wear_status = hx3695_hrs_get_wear_status(); diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index 59943f0d3..c9d5a99f6 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -64,6 +64,7 @@ uint8_t light_databuf[64] = {0}; static unsigned long g_app_queue; static bool ppg_service_running_stat = false; +static bool ppg_sensor_exist = false; static uint8_t wear_mode_state = 0; static uint8_t keep_in_wear_det_mod = 1; //持续坚持 佩戴检测模式 @@ -265,6 +266,8 @@ uint32_t ppg_resume(void) void send_ppg_cmd_msg(int cmd) { int ret; + if (ppg_sensor_exist == false) + return ; PPG_CMD_TYPE_T mail = 0; mail = cmd; @@ -282,10 +285,7 @@ static void ppg_service_check_task(void *arg) int32_t ret; uint32_t mail; uint32_t msgsize = (uint32_t)sizeof(PPG_CMD_TYPE_T); -#ifdef PPG_HX3695 - hx3695_register_msg_callback(hx3695_msg_callback);//注册驱动回调 - // ppg_send_cmd_to_driver("wear",0); -#endif + while (1) { ret = osal_msg_queue_read_copy(g_app_queue, (void *)&mail, &msgsize, OSAL_MSGQ_WAIT_FOREVER); @@ -385,6 +385,26 @@ errcode_t uapi_ppg_service_init(void) PRINT("uapi_ppg_service_init !\r\n"); + + + +#ifdef PPG_HX3695 + tyhx_poweron(); + if ( hx3695_chip_check() == false) + { + //TODO 没找到3695,退出线程 + PRINT("3695 not exist!\r\n"); + tyhx_poweroff(); + return ERRCODE_FAIL; + } + tyhx_poweroff(); + hx3695_register_msg_callback(hx3695_msg_callback);//注册驱动回调 + // ppg_send_cmd_to_driver("wear",0); + + ppg_sensor_exist = true; +#endif + + app_task_definition_t taskcfg={0}; taskcfg.create_queue_handle = create_ppg_queue; taskcfg.attr.name="ppg_service"; diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp index 8b1fa5e02..768a6eac3 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp @@ -103,8 +103,7 @@ extern void restart_sleep_cat1_timer(void); void cat1_ring_isr_callback(pin_t pin, uintptr_t param) { WEARABLE_LOGW(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1_ring_isr_callback %d 0x%X\n",pin,param); - uapi_cat1_add_cat1_vote(); - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_REMOVE_CAT1VOTE,NULL,0); + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_ADD_CAT1VOTE,NULL,0); } void uapi_cat1_wakeup_cat1(uint8_t wakeup) diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index eef29ad9c..84c10be05 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -323,10 +323,8 @@ int cat1_handle_timesync(struct tcp_msg_t *msg) return 1; } - -static void timeout_handler_sleep_cat1(void) +void mcu_remove_sleepvote_and_stoptimer(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"sleep mcu\n"); // uapi_cat1_wakeup_cat1(0);// 反馈给cat1,它也可以自己睡 if(osTimerIsRunning(g_timer_cat1_sleep)==1 ) { @@ -334,7 +332,11 @@ static void timeout_handler_sleep_cat1(void) WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"osTimerStop g_timer_cat1_sleep ret %d\n",ret); } uapi_cat1_remove_cat1_vote(); //接收到指令,让自己可以睡 - +} +static void timeout_handler_sleep_cat1(void) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"sleep mcu\n"); + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_REMOVE_CAT1VOTE,NULL,0); } //目前只在 被cat1唤醒的中断函数里执行, void restart_sleep_cat1_timer(void) @@ -351,8 +353,8 @@ void restart_sleep_cat1_timer(void) } if(osTimerIsRunning(g_timer_cat1_sleep)==0 ) { - uint32_t tick = (uint32_t )osMs2Tick(5000); // 5 seconds - osStatus_t ret = osTimerStart(g_timer_cat1_sleep,tick); //5秒后重试同步时间 + // uint32_t tick = (uint32_t )osMs2Tick(5000); // 5 seconds + osStatus_t ret = osTimerStart(g_timer_cat1_sleep,5000); //5秒后重试同步时间 WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"osTimerStart g_timer_cat1_sleep ret %d\n",ret); } } @@ -387,8 +389,8 @@ void restart_time_sync(void) if(osTimerIsRunning(g_timer_time_sync)==0 ) { // WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 restart_time_sync timer \n"); - uint32_t tick = (uint32_t )osMs2Tick(5000); // 60000: seconds of a minute - osStatus_t ret = osTimerStart(g_timer_time_sync,tick); //5秒后重试同步时间 + // uint32_t tick = (uint32_t )osMs2Tick(5000); // 60000: seconds of a minute + osStatus_t ret = osTimerStart(g_timer_time_sync,5000); //5秒后重试同步时间 WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 restart_time_sync timer ret %d\n",ret); } diff --git a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c index 73c0a3ff8..1ba8d7486 100644 --- a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c +++ b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c @@ -92,9 +92,13 @@ static void custom_cmd_service_check_task(void const *arg) // 根据邮件中的命令进行相应的处理 switch (mail.cmd) { - case CUSTOM_CMD_MSG_TYPE_REMOVE_CAT1VOTE: + case CUSTOM_CMD_MSG_TYPE_ADD_CAT1VOTE: + uapi_cat1_add_cat1_vote(); restart_sleep_cat1_timer(); break; + case CUSTOM_CMD_MSG_TYPE_REMOVE_CAT1VOTE: + mcu_remove_sleepvote_and_stoptimer(); + break; case CUSTOM_CMD_MSG_TYPE_CHANGE_SYSTEM_VOLUME: { // printf("mail.data: %d\n", *mail.data); diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index d430101a2..0e578eb8f 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -1116,17 +1116,21 @@ void get_gsensor_single(uint8_t *databuf) { gsenson_t t; get_gsonsen_xyz(&t); + uint16_t x,y,z; + x = t.x*2048; + y = t.y*2048; + z = t.z*2048; - databuf[0] = (uint8_t)((t.x & 0xFF00) >> 8); - databuf[1] = (uint8_t)(t.x & 0x00FF); + databuf[0] = (uint8_t)((x & 0xFF00) >> 8); + databuf[1] = (uint8_t)(x & 0x00FF); - databuf[2] = (uint8_t)((t.y & 0xFF00) >> 8); - databuf[3] = (uint8_t)(t.y & 0x00FF); + databuf[2] = (uint8_t)((y & 0xFF00) >> 8); + databuf[3] = (uint8_t)(y & 0x00FF); - databuf[4] = (uint8_t)((t.z & 0xFF00) >> 8); - databuf[5] = (uint8_t)(t.z & 0x00FF); + databuf[4] = (uint8_t)((z & 0xFF00) >> 8); + databuf[5] = (uint8_t)(z & 0x00FF); - PRINT("x : %d, y : %d, z : %d \r\n",t.x,t.y,t.z); + PRINT("x : %.2f, y : %.2f, z : %.2f \r\n",t.x,t.y,t.z); PRINT("GSENSOR: %2X %2X %2X %2X %2X %2X\r\n",databuf[0],databuf[1],databuf[2],databuf[3],databuf[4],databuf[5]); } diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 1801a3020..b11342ba2 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -138,9 +138,11 @@ uint32_t uapi_calendar_recover_date(void); uint32_t uapi_calendar_store_date(void); -#define CUSTOM_CMD_MSG_TYPE_REMOVE_CAT1VOTE 0x01 +#define CUSTOM_CMD_MSG_TYPE_ADD_CAT1VOTE 0x01 #define CUSTOM_CMD_MSG_TYPE_CHANGE_SYSTEM_VOLUME 0x02 #define CUSTOM_CMD_MSG_TYPE_CHANGE_CALL_VOLUME 0x03 +#define CUSTOM_CMD_MSG_TYPE_REMOVE_CAT1VOTE 0x04 + errcode_t uapi_custom_cmd_service_init(void); void do_custom_cmd_service_check_msg(int cmd, void *params, int paramlen); -- 2.17.1