1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include "system.h"
- #include "app_client_dataupdate.h"
- #include "hal_ble_client.h"
- #include "hal_flash.h"
- #include "bsp_time.h"
- #include "system.h"
- #include "app_host.h"
- #include "app_step.h"
- #include "hal_battery.h"
- #include "hal_imu.h"
- void app_client_DataUpdate_Send(void)
- {
- //>> 1(设备数据)
- //<< 1(子命令): 左鞋电量(1)+左鞋温度(1)+左鞋压力(4)+左鞋步数(4)+右鞋电量(1)+右鞋温度(1)+右鞋压力(4)+右鞋步数(4)
- uint8_t buf[32];
- uint8_t L=0;
- int32_t temperature;
- // uint32_t press = 0;
-
- sd_temp_get(&temperature);
- temperature = temperature>>2;
- // press = IMU_GetPressRAW(); //获取压力
-
- // SEGGER_RTT_printf(0,"temperature=%d\n",temperature);
- // SEGGER_RTT_printf(0,"press=%d\n",press);
-
- //子命令
- buf[L++] = BLE_Client_T_UPDATE_DATA;
- //左鞋
- buf[L++] = GetBatteryPersent();
- buf[L++] = (uint8_t)temperature;
- // buf[L++] = (uint8_t)(press>>24);
- // buf[L++] = (uint8_t)(press>>16);
- // buf[L++] = (uint8_t)(press>>8);
- // buf[L++] = (uint8_t)(press>>0);
- buf[L++] = 0;
- buf[L++] = 0;
- buf[L++] = 0;
- buf[L++] = 0;
-
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[0]>>24);
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[0]>>16);
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[0]>>8);
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[0]>>0);
- //右鞋
- buf[L++] = app_host_GetVol_R();
- buf[L++] = app_host_GetTemp_R();
- buf[L++] = (uint8_t)(app_host_GetPress_R()>>24);
- buf[L++] = (uint8_t)(app_host_GetPress_R()>>16);
- buf[L++] = (uint8_t)(app_host_GetPress_R()>>8);
- buf[L++] = (uint8_t)(app_host_GetPress_R()>>0);
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[1]>>24);
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[1]>>16);
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[1]>>8);
- buf[L++] = (uint8_t)(mFlash.mStep.stepCur[1]>>0);
-
- BLE_Client_Tx_Send(0,BLE_Client_T_UPDATE,buf,L);
- }
|