mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 17:55:19 +03:00
RAM saving
This commit is contained in:
parent
c12eb34691
commit
62c7a1978e
23 changed files with 306 additions and 204 deletions
|
@ -86,31 +86,31 @@ static void sendFailsafeChannels(uint8_t port)
|
|||
}
|
||||
}
|
||||
|
||||
void setupPulsesMultimodule(uint8_t port)
|
||||
void setupPulsesMultimodule()
|
||||
{
|
||||
static int counter = 0;
|
||||
|
||||
#if defined(PPM_PIN_SERIAL)
|
||||
modulePulsesData[EXTERNAL_MODULE].dsm2.serialByte = 0 ;
|
||||
modulePulsesData[EXTERNAL_MODULE].dsm2.serialBitCount = 0 ;
|
||||
extmodulePulsesData.dsm2.serialByte = 0 ;
|
||||
extmodulePulsesData.dsm2.serialBitCount = 0 ;
|
||||
#else
|
||||
modulePulsesData[EXTERNAL_MODULE].dsm2.rest = multiSyncStatus.getAdjustedRefreshRate();
|
||||
modulePulsesData[EXTERNAL_MODULE].dsm2.index = 0;
|
||||
extmodulePulsesData.dsm2.rest = multiSyncStatus.getAdjustedRefreshRate();
|
||||
extmodulePulsesData.dsm2.index = 0;
|
||||
#endif
|
||||
|
||||
modulePulsesData[EXTERNAL_MODULE].dsm2.ptr = modulePulsesData[EXTERNAL_MODULE].dsm2.pulses;
|
||||
extmodulePulsesData.dsm2.ptr = extmodulePulsesData.dsm2.pulses;
|
||||
|
||||
// Every 1000 cycles (=9s) send a config packet that configures the multimodule (inversion, telemetry type)
|
||||
counter++;
|
||||
if (counter % 1000== 500) {
|
||||
sendSetupFrame();
|
||||
} else if (counter % 1000 == 0 && g_model.moduleData[port].failsafeMode != FAILSAFE_NOT_SET && g_model.moduleData[port].failsafeMode != FAILSAFE_RECEIVER) {
|
||||
sendFrameProtocolHeader(port, true);
|
||||
} else if (counter % 1000 == 0 && g_model.moduleData[EXTERNAL_MODULE].failsafeMode != FAILSAFE_NOT_SET && g_model.moduleData[EXTERNAL_MODULE].failsafeMode != FAILSAFE_RECEIVER) {
|
||||
sendFrameProtocolHeader(EXTERNAL_MODULE, true);
|
||||
sendFailsafeChannels(port);
|
||||
} else {
|
||||
// Normal Frame
|
||||
sendFrameProtocolHeader(port, false);
|
||||
sendChannels(port);
|
||||
sendFrameProtocolHeader(EXTERNAL_MODULE, false);
|
||||
sendChannels(EXTERNAL_MODULE);
|
||||
}
|
||||
|
||||
putDsm2Flush();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue