Commit Graph
44 Commits
Author SHA1 Message Date
Jean Cyr 3a4da7c5fa Revert to original loop
Original loop was correct, and slightly more efficient. Retain
initialization of ret to handle the case where passed in count is 0.
2014-07-26 09:05:44 -04:00
Jean Cyr 2de38d0628 Improve update performance and clean up compiler warnings in px4io driver
- Fix compiler warnings in px4io_serial.cpp
- Fix compiler warnings in px4io_uploader.cpp
- Rename confusing overloaded send method with nearly identical
parameters in px4io_uploader.cpp
- Improve update performance by using maximum size programming buffer
since we are no longer limited by stack size.
2014-07-25 23:30:37 -04:00
Jean Cyr d9e3c9423e Clean up mavlink module
Deal with all mavlink module compiler warnings. No critical errors found
2014-07-16 23:41:13 -04:00
Jean Cyr e8c5b8230d px4io_uploader cleanup and minor optimization
Remove redundant code
Cleanup error handling in program function
2014-07-10 23:01:41 -04:00
Jean Cyr 12da0efbb2 Read the full buffer
sizeof wont work here since file_buf is now a pointer
2014-07-10 00:55:33 -04:00
Jean Cyr 8c6745d53f Prevent stack overflow when flashing px4io
Large local variable causing stack overflow when attempting to flash
IO!!!
2014-07-10 00:41:09 -04:00
Jean Cyr a6cf04a6ff Create system state entry in dataman - ATTN Anton
Create persistent system state id for data manager to store system state
that will persist across resets.
2014-06-08 14:08:22 -04:00
Jean Cyr cd9a72e391 Free data manager work items the same way they were allocated
Since data manager work items are allocated in groups of 8, they need to
be freed the same way should the manager need to stop.
2014-05-13 20:24:19 -04:00
Jean Cyr 8d3fed0944 Reduce potential dataman memory fragmentation
The data manager dynamically allocates relatively small work item blocks
on an as needed basis. It never frees these, instead maintaining then in
a list of available block for reuse when needed. Even if these blocks
are small, the are required at non-deterministic times and can end up
scattered in memory thus causing memory fragmentation. In order to
mitigate this problems work item blocks are allocated in groups of 8 in
contiguous memory to reduce the number of scattered memory allocations.
In reality, based on current usage, rarely will more than one group of 8
be allocated.
2014-05-13 19:59:44 -04:00
Jean Cyr ab257ebcce Proper data manager restart handling
Introduce SYS_RESTART_TYPE parameter having one of 3 values: boot
restart, inflight restart, or unknown restart, and defaulting to unknown
restart.

px4io.cpp sets this parameter according to the type of restart detected.

dataman.c retrieves this parameter and clears data entries according to
their persistence level. Does nothing if unknown restart.
2014-04-28 00:52:19 -04:00
Jean Cyr bf4558c31b Reduce data manager SD card wear and tear
When the data manager was first designed each file record contained a 2
byte header and an 126 byte data section, resulting in a record length
of 128 bytes. Along the way it was decided to add 2 spare bytes to the
record header, but regrettably the data section was not correspondingly
reduced in size so we end up with a record length of 130 bytes. This is
bad since it does not align with SD card flash sectors and results in
more erase/write flash cycles than necessary thus reducing the SD cards
life.

This update reduced the data section of the data manager to 124,
resulting in an optimal record length of 128 bytes.

In order to avoid the reuse of data previously written data in the old
format, which could result in catastrophic misinterpretation, the data
manager file is checked at startup. If it is found to be in the old
format, it is deleted and recreated with in the new record length. In
this case previously stored data is lost, but that is far safer than the
unpredictable result of using the old file.
2014-04-22 01:19:01 -04:00
Jean Cyr debb4f7021 Coding style
astyle according to http://pixhawk.org/dev/code_style
2014-03-23 01:35:13 -04:00
Jean Cyr 17c18947a4 Remove uneccesary dependencies and update credits 2014-03-23 01:05:06 -04:00
Jean Cyr b92b08ae62 Optimize and update data manager docs
Move repeated code to common function
Update missing and misleading comments
Fix data manager test compile errors
No functional changes
2014-02-02 00:42:15 -05:00
Jean Cyr 1cf9f72f62 Add data manager module and fence support to navigator
- Add function to geo.c to determine if global position is inside fence
- Add navigator support/commands for maintaining fence coords.
- Add data manager module to support persistence fence storage. Can
store other data, but only used for fence at this time.
- Add unit tests for data manager
2013-11-03 12:40:13 -05:00
Jean Cyr f1c399a60b Add support for 8 channel DSMX sattelite pairing 2013-10-12 01:14:03 -04:00
Jean Cyr 6f54825000 Comments in GPS UORB topic don't make sense
- Describe long, lat, and alt coordinates properly
2013-09-22 23:17:27 -04:00
Jean Cyr 72df378577 Finally get the #if right!!! 2013-09-18 20:24:33 -04:00
Jean Cyr 390d5b34de Fix backwards ifdef in dsm.c 2013-09-18 20:14:53 -04:00
Jean Cyr 89d3e1db28 Implement Spektrum DSM pairing in V2
- Bind control for V2
- Relays and accessory power not supported on V2 hardware
2013-09-18 20:04:22 -04:00
Jean Cyr 41610ff7dd DSM pairing cleanup in px4io.cpp
- Simplify parameter range checking in dsm_bind_ioctl
- Replace DSM magic numbers with symbolic constants
2013-09-12 21:36:20 -04:00
Jean Cyr 41982579b3 Refactor dsm binding code in px4io.cpp
- Move repeated code into member function
2013-09-11 22:54:23 -04:00
Jean Cyr 3b8039e4e0 Implement message based receiver pairing 2013-09-11 22:11:37 -04:00
Jean Cyr 54644e4206 Allow tone_alarm cmd to take filename as parameter
- Restore ability to play beloved William Tell Overture... from file
2013-08-31 16:06:15 -04:00
Jean Cyr b80f0d46ae Allow tone_alarm cmd to use tone names as well as number
- remove script dependency on hard coded tone numbers
- fix bug restarting repeating tone after stop
2013-08-31 01:03:32 -04:00
Jean Cyr f246b68c7b Fix parameter range check 2013-08-30 20:24:14 -04:00
Jean Cyr efca6f2cb1 Remove unused tones and save about 6K flash space
- Comment out unused tones
- Create symbolic tone numbers rather than hardcoded
2013-08-30 20:12:35 -04:00
Jean Cyr 3f800e5861 Make it obvious that file * isn't used here 2013-08-17 10:29:35 -04:00
Jean Cyr 0301e2d145 Flesh out PX4IO documentation comments and delete unnecessary class var 2013-08-16 20:09:22 -04:00
Jean Cyr bafc5ea8a1 Remoce C++ style Doxygen comments
Replace C++ style comments with C comments
2013-08-16 18:35:52 -04:00
Jean Cyr ab80b0e273 Doxygenate and style dsm.c
One file a day... this'll take a while!
2013-08-15 19:51:36 -04:00
Jean Cyr 0b93555043 Tell mavlink about bind results 2013-08-11 21:16:55 -04:00
Jean Cyr 35ec651cee Remove unused IOCTLs 2013-08-11 18:07:25 -04:00
Jean Cyr 1d408b80ad Support DSM bind via QGroundControl 2013-08-11 17:19:54 -04:00
Jean Cyr 36679fbb39 Some DSM satellites are fussier about bind pulse timing
These values work better
2013-08-10 11:22:08 -04:00
Jean Cyr 39b3fc8d32 Don't leave RX in bind mode on console open fail
Don't leave RX in bind mode in the unlikely eventuality that console
open fails
2013-07-11 10:36:17 -04:00
Jean Cyr 897b541b12 General cleanup of /dev/px4io and /dev/px4fmu
- Use distinct common symbols for px4io and px4fmu device files, and use
instead of hardcoded filenames
- Use common symbols defining px4io bits consistently between px4fmu and
px4io builds.
2013-07-09 20:37:00 -04:00
Jean Cyr 3188250634 Fix documentation fonts 2013-07-08 00:13:17 -04:00
Jean Cyr a7d5248f05 Feature documentation 2013-07-08 00:07:00 -04:00
Jean Cyr 20103f572f Minor px4io optimization
Since this module creates the PX4IO object and that the IOCTL function
doesn't use the file descriptor parameter, there is no need to invoke
IOCTL via the filesystem since we can call it directly.
2013-07-07 20:19:27 -04:00
Jean Cyr dab652faf6 Prevent RELAY1 control via IOCTL if DSM bind feature is enabled 2013-07-07 19:04:30 -04:00
Jean Cyr 35711280df Merge remote-tracking branch 'upstream/master' 2013-07-07 14:29:30 -04:00
Jean Cyr 7a6a786708 Merge remote-tracking branch 'upstream/master' 2013-07-07 09:12:42 -04:00
Jean Cyr 3f9f2018e2 Support binding DSM2 and DSMX satellite receivers
The px4io bind command allows you to put a DSM satellite receiver into
bind mode. Since this feature requires that
the dsm VCC line (red wire) be cut and routed through relay one, it is
not enabled by default in order not to
affect those not using a DSM satellite receiver or wising to use relay
one for other purposes.

NOTE: Binding DSM2 satellites in 11-bit mode is not supported due to
potential bug in some DSM2 receiver streams
when in 11-bit mode. Furthermore the px4io software folds 11 bit data
down to 10 bits so there is no resolution
advantage to to 11-bit mode.

To enable the feature the RC_RL1_DSM_VCC parameter must be set to a non
zero value from the console, or using
QGroundControl:

param set RC_RL1_DSM_VCC 1

From the console you can initiate DSM bind mode with:

uorb start
param set RC_RL1_DSM_VCC 1
px4io start
px4io bind dsm2

For binding a DSMX satellite to a DSMX transmitter you would instead
use:

px4io bind dsmx

Your receiver module should start a rapid flash and you can follow the
normal binding sequence of your
transmitter.

Note: The value of parameter RC_RL1_DSM_VCC defaults to 0, so none of
this will have any effect on an unmodified
DSM receiver connection. For this feature to work, the power wire (red)
must be cut and each side connected to a
terminal on relay1 of the px4io board.

This has been tested using Spektrum as well as Hobby King 'Orange' DSM
satellite receivers.

Both px4fmu and px4io images are updated.
2013-07-05 20:51:29 -04:00