feat: updated all mode instruction
This commit is contained in:
@@ -570,41 +570,46 @@ static void manual_scan_mode(uint8_t *ins, uint16_t size)
|
||||
|
||||
switch (p_ins->opcode)
|
||||
{
|
||||
case 0x00: // manual_scan_mode start
|
||||
// 30 00 01 00 01 00 00 00 05 00 03
|
||||
|
||||
send_start_package(&packet_buf, sizeof(packet_buf));
|
||||
pel_scan_msg.opcode = PEL_START;
|
||||
pel_scan_msg.resistor_setting.is_pattern = p_ins->param[0];
|
||||
pel_scan_msg.resistor_setting.value = u8_to_u32(p_ins->param[1], p_ins->param[2], p_ins->param[3], p_ins->param[4]);
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.count = u8_to_u16(p_ins->param[5], p_ins->param[6]);
|
||||
pel_scan_msg.notify_setting.drop = 0;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
break;
|
||||
|
||||
case 0x01: // manual_scan_mode set resistor
|
||||
// 30 00 01 01 01 00 00 00 07 00 03 (pattern_index)
|
||||
// 30 00 01 01 00 00 00 00 F0 00 03 (resistor_mask)
|
||||
pel_scan_msg.opcode = PEL_SET_RESISTOR;
|
||||
pel_scan_msg.resistor_setting.is_pattern = p_ins->param[0];
|
||||
pel_scan_msg.resistor_setting.value = u8_to_u32(p_ins->param[1], p_ins->param[2], p_ins->param[3], p_ins->param[4]);
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.count = u8_to_u16(p_ins->param[5], p_ins->param[6]);
|
||||
pel_scan_msg.notify_setting.drop = 0;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
break;
|
||||
|
||||
case 0x02: // manual_scan_mode stop
|
||||
// 30 00 01 02
|
||||
case 0x00: {
|
||||
// manual_scan_mode stop
|
||||
// 30 00 01 00
|
||||
pel_scan_msg.opcode = PEL_STOP;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode), pdMS_TO_TICKS(500)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x01: {
|
||||
// manual_scan_mode start
|
||||
// 30 00 01 01 00 01 00 05 00 0A 00 03 (pattern_index)
|
||||
// 30 00 01 01 00 00 00 F0 00 0A 00 03 (resistor_mask)
|
||||
send_start_package(&packet_buf, sizeof(packet_buf));
|
||||
pel_scan_msg.opcode = PEL_START;
|
||||
pel_scan_msg.resistor_setting.is_pattern = u8_to_u16(p_ins->param[0], p_ins->param[1]) & 0x01;
|
||||
pel_scan_msg.resistor_setting.value = u8_to_u16(p_ins->param[2], p_ins->param[3]);
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.drop = u8_to_u16(p_ins->param[4], p_ins->param[5]);
|
||||
pel_scan_msg.notify_setting.count = u8_to_u16(p_ins->param[6], p_ins->param[7]);
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x02: {
|
||||
// manual_scan_mode set resistor
|
||||
// 30 00 01 02 00 01 00 07 00 0A 00 03 (pattern_index)
|
||||
// 30 00 01 02 00 00 00 F0 00 0A 00 03 (resistor_mask)
|
||||
pel_scan_msg.opcode = PEL_SET_RESISTOR;
|
||||
pel_scan_msg.resistor_setting.is_pattern = u8_to_u16(p_ins->param[0], p_ins->param[1]) & 0x01;
|
||||
pel_scan_msg.resistor_setting.value = u8_to_u16(p_ins->param[2], p_ins->param[3]);
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.drop = u8_to_u16(p_ins->param[4], p_ins->param[5]);
|
||||
pel_scan_msg.notify_setting.count = u8_to_u16(p_ins->param[6], p_ins->param[7]);
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -640,73 +645,42 @@ static void auto_scan_mode(uint8_t *ins, uint16_t size)
|
||||
|
||||
switch (p_ins->opcode)
|
||||
{
|
||||
case 0x03: {
|
||||
// auto_scan_mode start with drop n * 10ms
|
||||
// 30 00 02 03 00 1C 00 01 00 0A 00 05
|
||||
uint32_t pattern_max = u8_to_u16(p_ins->param[0], p_ins->param[1]);
|
||||
uint32_t pattern_min = u8_to_u16(p_ins->param[2], p_ins->param[3]);
|
||||
uint32_t drop_10ms = u8_to_u16(p_ins->param[4], p_ins->param[5]);
|
||||
uint32_t notify_count = u8_to_u16(p_ins->param[6], p_ins->param[7]);
|
||||
|
||||
send_start_package(&packet_buf, sizeof(packet_buf));
|
||||
|
||||
for (uint32_t i = pattern_min; i <= pattern_max; i++)
|
||||
{
|
||||
pel_scan_msg.opcode = PEL_START;
|
||||
pel_scan_msg.resistor_setting.is_pattern = true;
|
||||
pel_scan_msg.resistor_setting.value = i;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.count = notify_count;
|
||||
pel_scan_msg.notify_setting.drop = drop_10ms;
|
||||
pel_scan_msg.notify_setting.complete_cb = auto_scan_complete;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
wait_auto_scan_complete();
|
||||
}
|
||||
|
||||
pel_scan_msg.opcode = PEL_STOP;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode), pdMS_TO_TICKS(500)));
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x00: {
|
||||
// auto_scan_mode start
|
||||
// 30 00 02 00 00 00 00 1C 00 00 00 01 00 05
|
||||
uint32_t pattern_max = u8_to_u32(p_ins->param[0], p_ins->param[1], p_ins->param[2], p_ins->param[3]);
|
||||
uint32_t pattern_min = u8_to_u32(p_ins->param[4], p_ins->param[5], p_ins->param[6], p_ins->param[7]);
|
||||
uint32_t notify_count = u8_to_u16(p_ins->param[8], p_ins->param[9]);
|
||||
|
||||
send_start_package(&packet_buf, sizeof(packet_buf));
|
||||
|
||||
for (uint32_t i = pattern_min; i <= pattern_max; i++)
|
||||
{
|
||||
pel_scan_msg.opcode = PEL_START;
|
||||
pel_scan_msg.resistor_setting.is_pattern = true;
|
||||
pel_scan_msg.resistor_setting.value = i;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.count = notify_count;
|
||||
pel_scan_msg.notify_setting.drop = 0;
|
||||
pel_scan_msg.notify_setting.complete_cb = auto_scan_complete;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
wait_auto_scan_complete();
|
||||
}
|
||||
|
||||
pel_scan_msg.opcode = PEL_STOP;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode), pdMS_TO_TICKS(500)));
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
// auto_scan_mode stop
|
||||
// 30 00 02 01
|
||||
// 30 00 02 00
|
||||
pel_scan_msg.opcode = PEL_STOP;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode), pdMS_TO_TICKS(500)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x01: {
|
||||
// auto_scan_mode start
|
||||
// 30 00 02 01 00 1C 00 01 00 0A 00 05
|
||||
uint16_t pattern_max = u8_to_u16(p_ins->param[0], p_ins->param[1]);
|
||||
uint16_t pattern_min = u8_to_u16(p_ins->param[2], p_ins->param[3]);
|
||||
|
||||
send_start_package(&packet_buf, sizeof(packet_buf));
|
||||
|
||||
for (uint16_t i = pattern_min; i <= pattern_max; i++)
|
||||
{
|
||||
pel_scan_msg.opcode = PEL_START;
|
||||
pel_scan_msg.resistor_setting.is_pattern = true;
|
||||
pel_scan_msg.resistor_setting.value = i;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.drop = u8_to_u16(p_ins->param[4], p_ins->param[5]);
|
||||
pel_scan_msg.notify_setting.count = u8_to_u16(p_ins->param[6], p_ins->param[7]);
|
||||
pel_scan_msg.notify_setting.complete_cb = auto_scan_complete;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
wait_auto_scan_complete();
|
||||
}
|
||||
|
||||
pel_scan_msg.opcode = PEL_STOP;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode), pdMS_TO_TICKS(500)));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -763,15 +737,18 @@ static void R_external_calibration_mode(uint8_t *ins, uint16_t size)
|
||||
|
||||
switch (p_ins->opcode)
|
||||
{
|
||||
case 0x00: {
|
||||
// R_external_calibration_mode stop
|
||||
// 30 00 03 00
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x01: {
|
||||
// R_external_calibration_mode start with drop n * 10ms
|
||||
// 30 00 03 01 00 0A 00 05
|
||||
uint32_t drop_10ms = u8_to_u16(p_ins->param[0], p_ins->param[1]);
|
||||
uint32_t notify_count = u8_to_u16(p_ins->param[2], p_ins->param[3]);
|
||||
|
||||
send_start_package(&packet_buf, sizeof(packet_buf));
|
||||
|
||||
for (uint32_t i = 0; i < COUNTOF(calibration_bits_pattern_tab); i++)
|
||||
for (uint16_t i = 0; i < COUNTOF(calibration_bits_pattern_tab); i++)
|
||||
{
|
||||
pel_scan_msg.opcode = PEL_START;
|
||||
pel_scan_msg.resistor_setting.is_pattern = false;
|
||||
@@ -779,8 +756,8 @@ static void R_external_calibration_mode(uint8_t *ins, uint16_t size)
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.resistor_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
pel_scan_msg.opcode = PEL_NOTIFY;
|
||||
pel_scan_msg.notify_setting.count = notify_count;
|
||||
pel_scan_msg.notify_setting.drop = drop_10ms;
|
||||
pel_scan_msg.notify_setting.drop = u8_to_u16(p_ins->param[0], p_ins->param[1]);
|
||||
pel_scan_msg.notify_setting.count = u8_to_u16(p_ins->param[2], p_ins->param[3]);
|
||||
pel_scan_msg.notify_setting.complete_cb = auto_scan_complete;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode) + sizeof(pel_scan_msg.notify_setting), pdMS_TO_TICKS(500)));
|
||||
|
||||
@@ -789,8 +766,8 @@ static void R_external_calibration_mode(uint8_t *ins, uint16_t size)
|
||||
|
||||
pel_scan_msg.opcode = PEL_STOP;
|
||||
ASSERT(xMessageBufferSend(pel_scan_msqQ, &pel_scan_msg, sizeof(pel_scan_msg.opcode), pdMS_TO_TICKS(500)));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -12,9 +12,9 @@ extern "C"
|
||||
|
||||
#define VERSION_DATE_YEAR 25
|
||||
#define VERSION_DATE_MONTH 3
|
||||
#define VERSION_DATE_DAY 12
|
||||
#define VERSION_DATE_HOUR 13
|
||||
#define VERSION_DATE_MINUTE 45
|
||||
#define VERSION_DATE_DAY 13
|
||||
#define VERSION_DATE_HOUR 10
|
||||
#define VERSION_DATE_MINUTE 0
|
||||
|
||||
#define PEL_0P5R_MASK (0x01 << 0)
|
||||
#define PEL_1P0R_MASK (0x01 << 1)
|
||||
|
||||
Reference in New Issue
Block a user