Spectrum analyser reworked (#6836)

* Spectrum analyser reworked

* Fix typo

* Cosmetics

* Cosmetics

* yet another overall look update

* T16 compilations fixes

* Various Taranis compile  fixes

* Cosmetics

* Cosmetics

* Cosmetics

* Cosmetics fixes
This commit is contained in:
3djc
2019-10-10 15:42:35 +02:00
committed by GitHub
parent 7094a744d6
commit 891c13e98d
16 changed files with 284 additions and 131 deletions
+10 -1
View File
@@ -37,7 +37,7 @@ void sendChannels(uint8_t moduleIdx);
static void sendMulti(uint8_t moduleIdx, uint8_t b)
{
#if defined(INTERNAL_MODULE_MULTI)
#if defined(HARDWARE_INTERNAL_MODULE)
if (moduleIdx == INTERNAL_MODULE) {
intmodulePulsesData.multi.sendByte(b);
}
@@ -171,6 +171,15 @@ void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe)
int8_t optionValue = g_model.moduleData[moduleIdx].multi.optionValue;
uint8_t protoByte = 0;
if (moduleState[moduleIdx].mode == MODULE_MODE_SPECTRUM_ANALYSER) {
sendMulti(moduleIdx, (uint8_t) 0x54); // Header byte
sendMulti(moduleIdx, (uint8_t) 54); // Spectrum custom protocol
sendMulti(moduleIdx, (uint8_t) 0);
sendMulti(moduleIdx, (uint8_t) 0);
return;
}
if (moduleState[moduleIdx].mode == MODULE_MODE_BIND)
protoByte |= MULTI_SEND_BIND;
else if (moduleState[moduleIdx].mode == MODULE_MODE_RANGECHECK)
+1 -1
View File
@@ -287,7 +287,7 @@ void setupPulsesExternalModule(uint8_t protocol)
}
#if defined(HARDWARE_INTERNAL_MODULE)
void enablePulsesInternalModule(uint8_t protocol)
static void enablePulsesInternalModule(uint8_t protocol)
{
// start new protocol hardware here
+29 -18
View File
@@ -41,6 +41,12 @@
#define IS_DSM2_PROTOCOL(protocol) (0)
#endif
#if defined(DSM2_SERIAL)
#define IS_DSM2_SERIAL_PROTOCOL(protocol) (IS_DSM2_PROTOCOL(protocol))
#else
#define IS_DSM2_SERIAL_PROTOCOL(protocol) (0)
#endif
#if defined(MULTIMODULE)
#define IS_MULTIMODULE_PROTOCOL(protocol) (protocol==PROTOCOL_CHANNELS_MULTIMODULE)
#if !defined(DSM2)
@@ -147,7 +153,8 @@ PACK(struct ModuleState {
uint8_t paused:1;
uint8_t spare:7;
uint16_t counter;
union {
union
{
ModuleInformation * moduleInformation;
ModuleSettings * moduleSettings;
ReceiverSettings * receiverSettings;
@@ -165,12 +172,14 @@ PACK(struct ModuleState {
moduleInformation->maximum = last;
mode = MODULE_MODE_GET_HARDWARE_INFO;
}
void readModuleSettings(ModuleSettings * destination)
{
moduleSettings = destination;
moduleSettings->state = PXX2_SETTINGS_READ;
mode = MODULE_MODE_MODULE_SETTINGS;
}
void writeModuleSettings(ModuleSettings * source)
{
moduleSettings = source;
@@ -178,12 +187,14 @@ PACK(struct ModuleState {
moduleSettings->timeout = 0;
mode = MODULE_MODE_MODULE_SETTINGS;
}
void readReceiverSettings(ReceiverSettings * destination)
{
receiverSettings = destination;
receiverSettings->state = PXX2_SETTINGS_READ;
mode = MODULE_MODE_RECEIVER_SETTINGS;
}
void writeReceiverSettings(ReceiverSettings * source)
{
receiverSettings = source;
@@ -238,21 +249,21 @@ PACK(struct CrossfirePulsesData {
union InternalModulePulsesData {
#if defined(PXX1)
#if defined(INTMODULE_USART)
UartPxx1Pulses pxx_uart;
#else
PwmPxx1Pulses pxx;
#endif
#if defined(INTMODULE_USART)
UartPxx1Pulses pxx_uart;
#else
PwmPxx1Pulses pxx;
#endif
#endif
#if defined(PXX2)
Pxx2Pulses pxx2;
#endif
#if defined(INTERNAL_MODULE_MULTI) //&& defined(INTMODULE_USART)
UartMultiPulses multi;
#if defined(MULTIMODULE) //&& defined(INTMODULE_USART)
UartMultiPulses multi;
#endif
#if defined(INTERNAL_MODULE_PPM)
PpmPulsesData<pulse_duration_t> ppm;
#endif
@@ -260,14 +271,14 @@ union InternalModulePulsesData {
union ExternalModulePulsesData {
#if defined(PXX1)
#if defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
UartPxx1Pulses pxx_uart;
#endif
#if defined(PPM_PIN_SERIAL)
SerialPxx1Pulses pxx;
#else
PwmPxx1Pulses pxx;
#endif
#if defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
UartPxx1Pulses pxx_uart;
#endif
#if defined(PPM_PIN_SERIAL)
SerialPxx1Pulses pxx;
#else
PwmPxx1Pulses pxx;
#endif
#endif
#if defined(PXX2)
@@ -417,4 +428,4 @@ inline bool isModuleInBeepMode()
return false;
}
#endif // _PULSES_H_
#endif // _PULSES_H_