flush notify buffer before start

This commit is contained in:
weiting2
2019-12-11 15:58:59 +08:00
parent 688868fb48
commit 046fae3617
2 changed files with 24 additions and 1 deletions
@@ -109,4 +109,27 @@ static void SendNotify() {
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
}
static void FlushNotify(){
not_buf[0] = INSTRUCTION.chip_id;
for (int i = 0; i < 4; i++) {
not_buf[i + 1] = 0;
not_buf[i + 5] = 0;
not_buf[i + 9] = 0;
}
// 1 Timestamp = 32 usec; 31 Timestamp ~= 1 msec
not_time_stamp = 0; // msec
not_buf[13] = not_time_stamp & 0xff;
not_buf[14] = (not_time_stamp >> 8) & 0xff;
not_buf[15] = (not_time_stamp >> 16) & 0xff;
not_buf[16] = (not_time_stamp >> 24) & 0xff;
// cyclic voltametry cycle number
not_buf[17] = 0xFF;
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
}
#endif
@@ -1027,7 +1027,7 @@ static void update_ZM_instruction(uint8 *ins) {
case VIS_STI: {
for(int i=0 ; i<12 ; i++){
SimpleProfile_SetParameter(BLE_DAT_BUFF_CHAR, BLE_DAT_BUFF_SIZE, not_buf);
FlushNotify();
}
PeriodicEvent = true;
break;