#include "system.h" #include "app_client_dataupdate.h" #include "hal_ble_client.h" #include "app_flash.h" #include "bsp_time.h" #include "system.h" #include "app_host.h" #include "app_step.h" #include "hal_battery.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; sd_temp_get(&temperature); temperature = temperature>>2; // 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++] = 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_UPDATE,buf,L); }