DWM22量产测试
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "pwm.h"
|
||||
#include "rf433_decoder.h"
|
||||
#include "timeslice.h"
|
||||
#include "usr_server.h"
|
||||
union rf433_flag rf_flag = {0};
|
||||
unsigned char high_level_time;
|
||||
unsigned char low_level_time;
|
||||
@@ -96,6 +97,7 @@ static uint8_t pair_deferred_command;
|
||||
static uint8_t pair_deferred_res_data;
|
||||
static uint32_t pair_deferred_receive_data;
|
||||
static uint8_t pair_command_replay;
|
||||
static uint8_t app_pairing_requested;
|
||||
|
||||
#define PAIR_HOLD_FRAME_COUNT 4U
|
||||
#define PAIR_FRAME_SILENCE_TICKS 100U
|
||||
@@ -258,6 +260,48 @@ static void Pairing_Candidate_Reset(void)
|
||||
pair_deferred_command = 0U;
|
||||
}
|
||||
|
||||
uint8_t rf433_paired_count(void)
|
||||
{
|
||||
uint8_t count = 0U;
|
||||
uint8_t i;
|
||||
|
||||
for(i = 0U; i < 5U; i++)
|
||||
{
|
||||
if(!Pairing_Address_IsEmpty(adress_H_array[i], adress_L_array[i]))
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
uint8_t rf433_start_pairing(void)
|
||||
{
|
||||
if(pairing_feedback_active)
|
||||
{
|
||||
ble_remote_event_notify(0x0DU, 0U, rf433_paired_count());
|
||||
return 0U;
|
||||
}
|
||||
|
||||
ssse = 0U;
|
||||
time_5s = 1U;
|
||||
pair_last_frame_sequence = rf_frame_sequence;
|
||||
Pairing_Candidate_Reset();
|
||||
app_pairing_requested = 1U;
|
||||
ble_remote_event_notify(0x0DU, 1U, rf433_paired_count());
|
||||
return 1U;
|
||||
}
|
||||
|
||||
void rf433_cancel_pairing(void)
|
||||
{
|
||||
ssse = 1U;
|
||||
time_5s = PAIRING_WINDOW_TICKS + 1U;
|
||||
Pairing_Candidate_Reset();
|
||||
if(app_pairing_requested)
|
||||
{
|
||||
app_pairing_requested = 0U;
|
||||
ble_remote_event_notify(0x0DU, 0U, rf433_paired_count());
|
||||
}
|
||||
}
|
||||
|
||||
void rf433_clear_code(void)
|
||||
{
|
||||
uint8_t i;
|
||||
@@ -276,7 +320,9 @@ void rf433_clear_code(void)
|
||||
time_5s = PAIRING_WINDOW_TICKS + 1U;
|
||||
Pairing_Candidate_Reset();
|
||||
Pairing_Feedback_Start(200U);
|
||||
app_pairing_requested = 0U;
|
||||
set_TaskComps_timer(2U, 2000U);
|
||||
ble_remote_event_notify(0x0EU, 1U, 0U);
|
||||
}
|
||||
|
||||
|
||||
@@ -284,6 +330,13 @@ void rf433_clear_code(void)
|
||||
static void Encoder_key_NoCode(){
|
||||
uint16_t times_s=0;
|
||||
uint8_t pairing_data_changed=0U;
|
||||
|
||||
if(app_pairing_requested &&
|
||||
(ssse != 0U || time_5s > PAIRING_WINDOW_TICKS))
|
||||
{
|
||||
app_pairing_requested = 0U;
|
||||
ble_remote_event_notify(0x0DU, 0U, rf433_paired_count());
|
||||
}
|
||||
|
||||
if(pair_frame_silence_ticks < 0xffU) pair_frame_silence_ticks++;
|
||||
if(pair_frame_silence_ticks > PAIR_FRAME_SILENCE_TICKS)
|
||||
@@ -383,6 +436,17 @@ static void Encoder_key_NoCode(){
|
||||
|
||||
ssse=1;
|
||||
if(pairing_data_changed) set_TaskComps_timer(2,2000);
|
||||
if(app_pairing_requested)
|
||||
{
|
||||
app_pairing_requested = 0U;
|
||||
if(res_data==Brightness_H ||
|
||||
res_data==B_Brightness_H ||
|
||||
res_data==F_Brightness_10)
|
||||
ble_remote_event_notify(0x0DU, 2U,
|
||||
rf433_paired_count());
|
||||
else
|
||||
ble_remote_event_notify(0x0EU, 1U, 0U);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user