HAL_QURT: remove ESC order mapping

this is not consistent between ModalAI vehicles, so best done with
SERVOn_FUNCTION parameters
This commit is contained in:
Andrew Tridgell 2024-07-16 07:47:35 +10:00
parent 8260648a66
commit a7363d4c14
2 changed files with 2 additions and 6 deletions

View File

@ -117,7 +117,7 @@ void RCOutput::send_receive(void)
int16_t data[5] {}; int16_t data[5] {};
for (uint8_t i=0; i<4; i++) { for (uint8_t i=0; i<4; i++) {
data[esc_map[i]] = pwm_to_esc(period[i]); data[i] = pwm_to_esc(period[i]);
} }
need_write = false; need_write = false;
@ -140,7 +140,7 @@ void RCOutput::send_receive(void)
*/ */
void RCOutput::handle_esc_feedback(const struct esc_response_v2 &pkt) void RCOutput::handle_esc_feedback(const struct esc_response_v2 &pkt)
{ {
const uint8_t idx = esc_map_rev[pkt.id_state>>4]; const uint8_t idx = pkt.id_state>>4;
if (idx >= ARRAY_SIZE(period)) { if (idx >= ARRAY_SIZE(period)) {
return; return;
} }

View File

@ -56,10 +56,6 @@ private:
void handle_esc_feedback(const struct esc_response_v2 &pkt); void handle_esc_feedback(const struct esc_response_v2 &pkt);
void handle_power_status(const struct esc_power_status &pkt); void handle_power_status(const struct esc_power_status &pkt);
// order is RL, FL, FR, RR, map to X frame
const uint8_t esc_map[4] {2, 0, 1, 3};
const uint8_t esc_map_rev[4] {1, 2, 0, 3};
int fd = -1; int fd = -1;
uint16_t enable_mask; uint16_t enable_mask;
static const uint8_t channel_count = 4; static const uint8_t channel_count = 4;