Skip to content

Commit

Permalink
chore: WIP: convert serial trainer to idle callback
Browse files Browse the repository at this point in the history
  • Loading branch information
gagarinlg committed Sep 27, 2023
1 parent 28a6118 commit 36ad3c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion radio/src/crsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void crsfTrainerPauseCheck();

namespace CRSF {
static constexpr uint32_t baudrate{420000};

void crsfTrainerOnIdle();
struct Servo {
using Crsf = Trainer::Protocol::Crsf;
using MesgType = Crsf::MesgType;
Expand Down
4 changes: 3 additions & 1 deletion radio/src/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,13 @@ static void serialSetCallBacks(int mode, void* ctx, const etx_serial_port_t* por
#if defined(SBUS_TRAINER)
case UART_MODE_SBUS_TRAINER:
case UART_MODE_IBUS_TRAINER:
case UART_MODE_CRSF_TRAINER:
case UART_MODE_SUMD_TRAINER:
sbusSetAuxGetByte(ctx, getByte);
// TODO: setRxCb (see MODE_LUA)
break;
case UART_MODE_CRSF_TRAINER:
if(port && && port->uart && port->uart->setIdleCb)
port->uart->setIdleCb(ctx, CRSF::crsfTrainerOnIdle);
break;
#endif

Expand Down
2 changes: 2 additions & 0 deletions radio/src/tasks/mixer_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ TASK_FUNCTION(mixerTask)
DEBUG_TIMER_START(debugTimerMixer);
mixerTaskLock();

processSerialTrainerInputs();

doMixerCalculations();
pulsesSendChannels();
doMixerPeriodicUpdates();
Expand Down

0 comments on commit 36ad3c1

Please sign in to comment.