app_losspack.c 758 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "app_losspack.h"
  2. #include "bsp_time.h"
  3. #include "app_flash.h"
  4. #include "system.h"
  5. #include "hal_ble_client.h"
  6. #include "ble_comm.h"
  7. #include "app_game.h"
  8. #if LOSSPACK_ENANBLE
  9. uint16_t lose_pack_all =0;
  10. void LossPack_process(void){
  11. if(app_game_GetGameMode()){
  12. uint16_t pack_l =0;
  13. uint8_t rssi = 0-host_get_rssi();
  14. pack_l = lose_pack_all;
  15. uint8_t buf[8];
  16. uint8_t L = 0;
  17. buf[L++] = (uint8_t)(pack_l>>8);
  18. buf[L++] = (uint8_t)(pack_l);
  19. buf[L++] = (uint8_t)(rssi);
  20. BLE_Client_Tx_Send(0,(BLE_CMD_n)0x03,buf,L);
  21. // DEBUG_LOG("lose_pack_all:%d, h_rssi=%d\r\n",lose_pack_all,rssi);
  22. lose_pack_all = 0;
  23. }
  24. }
  25. void app_losspack_Init(void)
  26. {
  27. if(mFlash.isHost)Process_Start(1000,"LossPack_process",LossPack_process);
  28. }
  29. #endif