This feature allows use of a transmitter module 'caddy' PCB, which facilitates
automatic DSM2(X) or Fr-Sky transmitter module switching, without having to
swap TX module on the back of the radio. Two antennas are installed on the
radio instead of attempting to switch 2.4GHz RF signals, for reliability. The
TX Caddy circuit schematic and PCB layout can be found in the gruvin9x hardware
project.
I am not really expecting anyone else to implement this feature. But it's there
for those who might and adding it to trunk prevent me having to manually port
the feature to new versions, each time I update my field radio.
-- Gruvin
See comments for r1577 for details. Short version is that I found
a deeper root cause for the problem and corrected that instead
of the previous fix, which turned out to be a band-aid only.
I found that wdt_reset() was not being called in the scheduled interrupt
iservice routine because HEART_TIMER_PULSES was not being flagged in
serial transmit interrupt. This is needed because in DSM2=SERIAL mode,
there are no bit-bang functions being used and thus no HEART_TIMER_PULSES
'heart beats' to record.
I am at a loss as to how or exactly when this bug crept in. I have gone
over everything I committed since r1380 but cannot find anything
directly related. So I just don't know. But it's fixed now. Yay \o/
I also added/edited a bunch more code comments along the way to finding this.
-#if defined(PCBGRUVIN9X)
+#if defined(PCBGRUVIN9X) && defined(DSM2_PPM)
DSM2=SERIAL mode continuous WDT reset problem still present. Still
can't figure out why. Still working on it. :-/
Gruvin.
output frame, where correct pulse polarity was not always set
until the second call to setupPulses, from within the PPM mode
pulse train interrupt handler.
I tested proper function in PPM mode on the logic analyser
before committing.
adjustment is NOT required for the stock board. Thus, all the problems Cam and
I have witnessed appear to apply only to the ATmega2560 chip -- bringing the
total number of design bugs in said chip that we alone have now found to 3.
I do not have any ATmega128 based boards to runs tests there-on.
The only change here is to the code comment on the same topic.
only, until more timing tests on stock board can be done.
In case you're wondering, I'm planning on using the PB7 back-light
conection on an otherwise unmodified board, for those tests --
since PORTH isn't available and all. ;-)
and compensated for main clock synchronisation to get accurate 8us bit
lengths, as measured on the logic analsyser.
Specifically, all 1 and 0 bits now measure 8.000us in length, instead of
varyting from 6.250us to 10.750us, as before.
NOTE: A similar len-5 / len+3 compensation is almost certainly required
to improve bit timing on the stock board, in software bit-bang mode,
but I did not want to commit such a change to trunk without being
able to bench test it first. The values might differ slightly, due
to the number of instruction cycles executed before the actual
PORT B bit toggle code is reached. But it will NOT be the same for
both 1 and 0 bits.
$ make ... PORTH_TIMING=YES
See code comments for details. This is used to analyse real-world timing of
mixer interrupt, setupPulses and PPM or DSM=SERIAL or DSM2=PPM data output
streams.
NOTE: Not compatible to SOUND=YES (SOMO14)
I can't compile the current trunk code, due to some Python error. But the fix here is important.
An #ifdefined was found to be in the wrong place in pulses_avr.cpp -- 99.999% certain. Am I right?
WARNING: All protocols shoul dbe testing on stock board again.
Fixed a number of problems relating to the (dis)enabling of hardware
switched PPM_OUT for the G9XV4 board. I also broke a lot of stuff along
the way over several previous commits, as I slowly learned how all the
code went together and the 'whys' for some stuff. My bad.
In other words, this commit finally has DSM2=PPM mode working on the
G9XV4 board without breaking a bunch of other stuff -- hopefully.
!! STOCK BOARD TESTING NEEDED !!
I am pretty sure I have not broken anything for the stock board code --
BUT it MUST be tested before the next release, because I have made quite
a few changes in and around that code.
added to DSM2=SERIAL code.
Hopefully also fixed DSMX mode bind omission from previous commit.
IMPORTANT: I do not have a DSMX module for testing -- only DSM2. Can someone
with DSM2=PPM mode and DSMX please test and confirm that both bind and range
check mode are working. Thanks.
I have modified the DSM2=PPM code to implelent bind and range check the
same way as for DSM2=SERIAL.
NOTE: I have checked for clean compile but do not have hardware to test
that the protocol is working correctly. PLEASE TEST. Thanks.
Tidied up Timer1 ISR code -- numerous little issues resolved, comments corrected.
Obviously, anything to do with this ISR requires thorough physical testing.
I have tested DSM2_SERIAL and the PCBV4 PPM_out is working properly. Someone
should double-check PPM/16/sim and I guess DSM2=PPM, on the stock board.
Thanks.
However, I don't like that the only place I could find to turn off range check mode when the SETUP menus is exited, was in popMenu ...
void popMenu()
{
if (g_menuStackPtr>0) {
#ifdef DSM2
s_rangecheck_mode = 0;
#endif
...
}
It was the only way I could find to trap the event of [EXIT long] being pressed
while in the RANGE field and s_editMode==true. But this solution gets executed
for all menu exits -- not just menuProcModels. It works, but there must be a
more eloquent method?
(It only took me about an hour and a half! :-/)
Also increased max filename length handled by "Restore Model" to 16 chars
(only when long filename support is configured in FatFs/ffconf.h)
Bertrand: I had to comment out a call to sdPollmS() as it doesn't seem to exist.
Hopefully the system freeze when I try to select "Restore Model" is
just a symptom of this same issue ... though I fear not.
Half -- because I don't yet know how to make warning sounds in this
new code. HELP! :P
... otherwise it's working. I have confirmed that
the range check bit appears on the scope, while watching the DSM2
data stream.
Some DSM2 modules take longer than others to power up. Thus, sending a
single BIND packet is not sufficient in some cases. I have implemented
here an approimately 4 second period (after power-up) during which
time the trainer swtich can activate BIND mode.
This is in fact not strictly needed, since the DSM module will by
itself reject bind packets after a short time. (I have confirmed this
again with my DSM2 module today.) However, we like to be sure, so the
limited time window for BIND activation remains.
The word "BIND" also now appears as confirmation in upper-right of
the main view, whenever bind packets are being sent to the DSM module.
(I did not consider it important to add this "BIND" word to the
language files. Please feel free to do so though, if warranted.)
Gruvin.