When I use hal.rcin->read(…), it can read all signals from RCIN. But when I call hal.rcout->write(…) there is nothing out at SBUS.
I already disable all safety functions.
#define MAX_RCIN_CHANNELS 16
static uint16_t last_rcin_value[MAX_RCIN_CHANNELS];
static bool inited = false;
void Rover::update_rcin()
{
if (inited == false) {
for (uint8_t i = 0; i < 16; i++) {
hal.rcout->enable_ch(i);
}
inited = true;
}
uint8_t nchannels = hal.rcin->num_channels();
if (nchannels == 0) {
gcs().send_text(MAV_SEVERITY_WARNING, "No channels detected");
return;
}
if (nchannels > MAX_RCIN_CHANNELS) {
nchannels = MAX_RCIN_CHANNELS;
}
bool changed[MAX_RCIN_CHANNELS];
for (uint8_t i = 0; i < nchannels; i++) {
changed[i] = false;
}
for (uint8_t i = 0; i < nchannels; i++) {
uint16_t v = hal.rcin->read(i);
hal.rcout->write(i, v);
if (last_rcin_value[i] != v) {
changed[i] = true;
last_rcin_value[i] = v;
}
}
gcs().send_text(MAV_SEVERITY_INFO, "%04u %04u %04u %04u %04u %04u %04u %04u",
(unsigned)last_rcin_value[0],
(unsigned)last_rcin_value[1],
(unsigned)last_rcin_value[2],
(unsigned)last_rcin_value[3],
(unsigned)last_rcin_value[4],
(unsigned)last_rcin_value[5],
(unsigned)last_rcin_value[6],
(unsigned)last_rcin_value[7]);
}
board : pixhawk fmuv3
firmware : Rover4.0.0
param SERVOx_FUNCTION = Disable