feat: refine remote states and PRTS LCD refresh

- add remote NOT_READY/READY/PROTECT state flow and matching LED/status display

- speed up TFT hardware SPI DMA flush path and larger LVGL partial refresh buffer

- reduce page/menu redraw artifacts and center the PRTS status title
This commit is contained in:
TuxMonkey
2026-07-21 00:40:01 +08:00
parent 8671f84139
commit dc57b5152e
10 changed files with 230 additions and 67 deletions

View File

@@ -102,6 +102,49 @@ static uint8_t SBusEndByteIsValid(uint8_t value)
return value == SBUS_END || value == 0x04u || value == 0x14u || value == 0x24u || value == 0x34u;
}
static uint8_t RemoteControlAllSwitchesDown(const RC_ctrl_t *rc)
{
return rc != NULL && switch_is_down(rc->sw_a) && switch_is_down(rc->sw_b) && switch_is_down(rc->sw_c) &&
switch_is_down(rc->sw_d);
}
static void RemoteControlSetMode(RobotMode_t mode)
{
if (RobotMode != SYS_ERROR_OCCURRED)
RobotMode = mode;
}
static void RemoteControlUpdateMode(const RC_ctrl_t *rc)
{
if (rc == NULL || RobotMode == SYS_ERROR_OCCURRED)
return;
switch (RobotMode)
{
case REMOTE_NOT_CONNECTED:
RemoteControlSetMode(REMOTE_NOT_READY);
break;
case REMOTE_NOT_READY:
if (RemoteControlAllSwitchesDown(rc))
RemoteControlSetMode(REMOTE_READY);
break;
case REMOTE_READY:
if (switch_is_up(rc->sw_d))
RemoteControlSetMode(NORMAL_MODE);
break;
case NORMAL_MODE:
if (switch_is_down(rc->sw_d))
RemoteControlSetMode(REMOTE_PROTECT);
break;
case REMOTE_PROTECT:
if (switch_is_up(rc->sw_d))
RemoteControlSetMode(NORMAL_MODE);
break;
default:
break;
}
}
#ifdef REMOTE_DJI_DT7
/**
@@ -364,8 +407,7 @@ static void RemoteControlPublishOffline(uint8_t force)
{
rc_data_valid = 0;
memset(rc_ctrl, 0, sizeof(rc_ctrl));
if (RobotMode != SYS_ERROR_OCCURRED)
RobotMode = REMOTE_NOT_CONNECTED;
RemoteControlSetMode(REMOTE_NOT_CONNECTED);
}
__set_PRIMASK(primask);
@@ -396,8 +438,7 @@ static void RemoteControlRxCallback(USART_Instance *instance, const uint8_t *rec
rc_valid_frame_count++;
rc_data_valid = 1;
DaemonReload(rc_daemon_instance);
if (RobotMode == REMOTE_NOT_CONNECTED)
RobotMode = REMOTE_CONNECTED;
RemoteControlUpdateMode(&rc_ctrl[TEMP]);
}
/**