This was only a problem when running as a task not on the work queue.
The problem was that init() opened the RC serial device, which was then
read in the main loop, which is a different context when run as a task.
Sorry for the large patch :)
- move cleanup into destructor (this was done on the wrong task before)
- move init into init() method
- sensor & peripheral reset do not start/stop fmu anymore
- remove err & errx (they do not release the lock and could lead to dead-
locks)
Ultimate we want this changes that is being backed out herein.
But it is breaking things because it returns the EINVAL
when there is a rate overlap. So the rest of the pwm ioctl
calls then fail and do not set the pulse widths on arming.
As a secondary issue. We sould call up_pwm_servo_init() to
establish the PWM channel allocation early. This then allows
FMU::set_pwm_rate to properly check for improper rate request
not isolate to one group (timer).
The root cause was the replacment of a local variable num_outputs
with the class member _num_outputs.
The effect of a "bad mix" is to return 0 - this clampped the
_num_outputs to 0.
Prior to commit 3b3e2b2 px4fmu: "consolidate usage of output mode"
this would not have been an issue because the local num_outputs
was reset every cycle"
As a secondary issue. We sould call up_pwm_servo_init() to
establish the PWM channel allocation early. This then allows
FMU::set_pwm_rate to properly check for improper rate request
not isolate to one group (timer).
Removed the legacy FMUv4 define that was activating a nonexistent
pull up and on some HW driving the PPM_IN aka RC_IN aka SPEKTRUM_RX
to VDD.
Use the abstaction SPEKTRUM_POWER to enable the interface not
the define for the GPIO pin.
Returned the fmu mixer code to where it updated the HW once
it has a mixer. But only signals a up_pwm_update() for
onshots on actual control update.
Before this change the hw outpuse were not updated.
A recent change in in the fmu stops the instance when a
xxxx_reset command is used issued if the fmu was not
already running.
That change left publications published and then on the
next creation created a new publications was created.
This change calls orb_unadvertise to mark the publication
as un published so that on the next instantiations of the
fmu it resumes publishing on the same publication.
This reverts commit 22738b1213fff704d288ec84976fa84ff9535aba.
The command was added due to a lack of my understanding of how the pwm command can be used.
The command is not needed as the all flag can be used or a proper
mask WHIHOUT -g
fmu task mode_pwm
pwm rate -a -r 50 -d /dev/pwm_output0
pwm arm
pwm test -a -p 500
fmu task mode_pwm
pwm oneshot -a -d /dev/pwm_output0 is the same as pwm oneshot -m 0xff -d /dev/pwm_output0
pwm arm
pwm test -a -p 500
change fmu to task
increase fmu_servo task priority to max and enable true oneshot
use lowest FMU priority which minimizes jitter
constrain oneshot updates to control group 0 events
The sensor_rest command added to the startup script for px4fmu_v4 hardware
was leaving the /dev/pwm_output0 driver open. This would prevent the
pwm_out_sim module from registering as a simulated driver. The result
would cause the system to properly boot in HIL mode, but you would not
be able to set any control surfaces.
Since sensor_rest and peripheral_reset are only used on initialization, the
drivers can be shut down after they have performed their reset functions.
Signed-off-by: zthorson <zachthorson@gmail.com>
return -EINVAL on any GPIO ioctl operation when there are
no GPIO pins defined in the board config. I.E.
BOARD_FMU_GPIO_TAB is not defined.
BOARD_FMU_GPIO_TAB is now optional and if it is defined
then the logical BOARD_HAS_FMU_GPIO is defined and
will enable the px4fmu driver to perform the physical GPIO
operations.
Move RC and DL failsafe actions handling from navigator to commander (credits to @AndreasAntener)
Separate manual kill switch handling via manual_lockdown to prevent override and release of software lockdown by RC switch
Other changes:
Add failsafe tune
Fix LED blinking for Pixracer
Return back support for rc inputs in simulator but now it is configurable via cmake