地磁8面校准完成

This commit is contained in:
lmx
2025-11-20 19:30:34 +08:00
parent 2bfdc81991
commit 9ccf1acda8
17 changed files with 1475 additions and 603 deletions

View File

@ -45,6 +45,10 @@
#include "default_event_handler.h"
#include "debug.h"
#include "system/event.h"
#include "./ano/ano_protocol.h"
#include "./sensor/MMC56.h"
#include "./sensor/BMP280.h"
#include "./sensor/AK8963.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
//宏定义
#define LOG_TAG_CONST EARPHONE
@ -199,18 +203,40 @@ void le_user_app_event_handler(struct sys_event* event){
if(event->u.app.buffer[2] == 0x01){ //后面的数据长度 1
switch (event->u.app.buffer[3]){
case 0x01:
extern void start_detection(void);
start_detection();
char* send_tmp = "start_detection\n";
char* send_start = "will start after 5 seconds\n";
send_data_to_ble_client(send_start,strlen(send_start));
if (mmc5603nj_init() != 0) {
xlog("MMC5603NJ initialization failed!\n");
char* send_error = "calibration error\n";
send_data_to_ble_client(send_error,strlen(send_error));
}
xlog("MMC5603NJ PID: 0x%02X\n", mmc5603nj_get_pid());
char* send_tmp = "8th calibration completed\n";
send_data_to_ble_client(send_tmp,strlen(send_tmp));
break;
case 0x02:
extern void create_process(u16* pid,char* name, void *priv, void (*func)(void *priv), u32 msec);
extern void sensor_measure(void);
static int test_id;
SL_SC7U22_Config();
create_process(&test_id, "test",NULL, sensor_measure, 10);
send_tmp = "start_detection\n";
send_data_to_ble_client(send_tmp,strlen(send_tmp));
break;
case 0x03:
extern void start_detection(void);
start_detection();
send_tmp = "start_detection\n";
send_data_to_ble_client(send_tmp,strlen(send_tmp));
break;
case 0x04:
extern void stop_detection(void);
stop_detection();
send_tmp = "stop_detection\n";
send_data_to_ble_client(send_tmp,strlen(send_tmp));
break;
case 0x03:
case 0x05:
extern void clear_speed(void);
clear_speed();
send_tmp = "Reset speed and distances to zero\n";