Merge pull request #477 from EdgeTX/403-access-denied
Enable ISRM internal module for non-FrSky hardware (T16 / TX16S / etc...)
This commit is contained in:
+3
-4
@@ -2,7 +2,6 @@
|
|||||||
path = radio/src/thirdparty/libopenui
|
path = radio/src/thirdparty/libopenui
|
||||||
url = https://github.com/EdgeTX/libopenui.git
|
url = https://github.com/EdgeTX/libopenui.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "libACCESS"]
|
[submodule "radio/src/thirdparty/AccessDenied"]
|
||||||
path = radio/src/thirdparty/libACCESS
|
path = radio/src/thirdparty/AccessDenied
|
||||||
url = https://github.com/FrSkyRC/libACCESS.git
|
url = https://github.com/raphaelcoeffic/AccessDenied.git
|
||||||
branch = master
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ set(FIRMWARE_CXX_COMPILER "${GCC_ARM_PATH}arm-none-eabi-g++" CACHE STRING "Speci
|
|||||||
set(FIRMWARE_ASM_COMPILER "${GCC_ARM_PATH}arm-none-eabi-as" CACHE STRING "Specific assembler for firmware target.")
|
set(FIRMWARE_ASM_COMPILER "${GCC_ARM_PATH}arm-none-eabi-as" CACHE STRING "Specific assembler for firmware target.")
|
||||||
set(FIRMWARE_OBJCOPY "${GCC_ARM_PATH}arm-none-eabi-objcopy" CACHE STRING "Specific objcopy for firmware target.")
|
set(FIRMWARE_OBJCOPY "${GCC_ARM_PATH}arm-none-eabi-objcopy" CACHE STRING "Specific objcopy for firmware target.")
|
||||||
set(FIRMWARE_SIZE "${GCC_ARM_PATH}arm-none-eabi-size" CACHE STRING "Specific size for firmware target.")
|
set(FIRMWARE_SIZE "${GCC_ARM_PATH}arm-none-eabi-size" CACHE STRING "Specific size for firmware target.")
|
||||||
|
set(FIRMWARE_RANLIB "${GCC_ARM_PATH}arm-none-eabi-ranlib" CACHE STRING "Specific ranlib for firmware target.")
|
||||||
|
|
||||||
set(THIRDPARTY_DIR thirdparty)
|
set(THIRDPARTY_DIR thirdparty)
|
||||||
set(LUA_DIR ${THIRDPARTY_DIR}/Lua/src)
|
set(LUA_DIR ${THIRDPARTY_DIR}/Lua/src)
|
||||||
@@ -499,8 +500,8 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL "")
|
|||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "")
|
||||||
# customize linker command
|
# customize linker command
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "")
|
set(CMAKE_EXE_LINKER_FLAGS "")
|
||||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
|
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
|
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||||
|
|
||||||
use_cxx11() # ensure gnu++11 in CXX_FLAGS with CMake < 3.1
|
use_cxx11() # ensure gnu++11 in CXX_FLAGS with CMake < 3.1
|
||||||
|
|
||||||
@@ -514,6 +515,7 @@ if(NOT MSVC)
|
|||||||
set(CMAKE_C_COMPILER ${FIRMWARE_C_COMPILER})
|
set(CMAKE_C_COMPILER ${FIRMWARE_C_COMPILER})
|
||||||
set(CMAKE_CXX_COMPILER ${FIRMWARE_CXX_COMPILER})
|
set(CMAKE_CXX_COMPILER ${FIRMWARE_CXX_COMPILER})
|
||||||
set(CMAKE_ASM_COMPILER ${FIRMWARE_ASM_COMPILER})
|
set(CMAKE_ASM_COMPILER ${FIRMWARE_ASM_COMPILER})
|
||||||
|
set(CMAKE_RANLIB ${FIRMWARE_RANLIB})
|
||||||
|
|
||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_SYSTEM_VERSION 1)
|
set(CMAKE_SYSTEM_VERSION 1)
|
||||||
@@ -528,10 +530,6 @@ if(NOT MSVC)
|
|||||||
# these are in addition to CMAKE_CXX_FLAGS
|
# these are in addition to CMAKE_CXX_FLAGS
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-lm -T${RADIO_SRC_DIR}/${LINKER_SCRIPT} -Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections")
|
set(CMAKE_EXE_LINKER_FLAGS "-lm -T${RADIO_SRC_DIR}/${LINKER_SCRIPT} -Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections")
|
||||||
|
|
||||||
if(ACCESS_LIB)
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--whole-archive ${RADIO_SRC_DIR}/${THIRDPARTY_DIR}/libACCESS/libAccess.a -Wl,--no-whole-archive")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SEMIHOSTING)
|
if(SEMIHOSTING)
|
||||||
add_definitions(-DSEMIHOSTING)
|
add_definitions(-DSEMIHOSTING)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=rdimon.specs")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --specs=rdimon.specs")
|
||||||
@@ -577,6 +575,12 @@ if(NOT MSVC)
|
|||||||
add_dependencies(firmware ${RADIO_DEPENDENCIES} ${FIRMWARE_DEPENDENCIES})
|
add_dependencies(firmware ${RADIO_DEPENDENCIES} ${FIRMWARE_DEPENDENCIES})
|
||||||
set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
|
|
||||||
|
if(ACCESS_DENIED)
|
||||||
|
add_subdirectory(thirdparty/AccessDenied)
|
||||||
|
include_directories(thirdparty/AccessDenied)
|
||||||
|
target_link_libraries(firmware AccessDenied)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET firmware POST_BUILD
|
TARGET firmware POST_BUILD
|
||||||
COMMAND ${FIRMWARE_OBJCOPY} -O binary firmware.elf firmware.bin
|
COMMAND ${FIRMWARE_OBJCOPY} -O binary firmware.elf firmware.bin
|
||||||
|
|||||||
@@ -1091,6 +1091,10 @@ int cliDebugVars(const char ** argv)
|
|||||||
serialPrint("ioMutexReq=%d", ioMutexReq);
|
serialPrint("ioMutexReq=%d", ioMutexReq);
|
||||||
serialPrint("ioMutexRel=%d", ioMutexRel);
|
serialPrint("ioMutexRel=%d", ioMutexRel);
|
||||||
serialPrint("sdReadRetries=%d", sdReadRetries);
|
serialPrint("sdReadRetries=%d", sdReadRetries);
|
||||||
|
#if defined(ACCESS_DENIED)
|
||||||
|
extern volatile int32_t authenticateFrames;
|
||||||
|
serialPrint("authenticateFrames=%d", authenticateFrames);
|
||||||
|
#endif
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
serialPrint("telemetryErrors=%d", telemetryErrors);
|
serialPrint("telemetryErrors=%d", telemetryErrors);
|
||||||
#endif
|
#endif
|
||||||
@@ -1189,6 +1193,57 @@ int cliBlueTooth(const char ** argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ACCESS_DENIED)
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "AccessDenied/access_denied.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t cryptInput[16];
|
||||||
|
static uint8_t cryptOutput[16];
|
||||||
|
|
||||||
|
static void testAccessDenied(uint32_t runs)
|
||||||
|
{
|
||||||
|
while(runs--)
|
||||||
|
access_denied(0, cryptInput, cryptOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cliCrypt(const char ** argv)
|
||||||
|
{
|
||||||
|
if (argv[1][0] == '\0')
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
strncpy((char*)cryptInput, argv[1], sizeof(cryptInput));
|
||||||
|
serialPrint("Input:");
|
||||||
|
dumpBody(cryptInput, sizeof(cryptInput));
|
||||||
|
dumpEnd();
|
||||||
|
|
||||||
|
watchdogSuspend(2000/* 20s */);
|
||||||
|
if (pulsesStarted()) {
|
||||||
|
pausePulses();
|
||||||
|
}
|
||||||
|
pauseMixerCalculations();
|
||||||
|
perMainEnabled = false;
|
||||||
|
|
||||||
|
uint32_t startMs = RTOS_GET_MS();
|
||||||
|
testAccessDenied(100000);
|
||||||
|
serialPrintf("access_denied: %f us/run\r\n", (RTOS_GET_MS() - startMs)*1000.0f / 100000.0f);
|
||||||
|
|
||||||
|
serialPrint("Decrypted (SW):");
|
||||||
|
dumpBody(cryptOutput, sizeof(cryptOutput));
|
||||||
|
dumpEnd();
|
||||||
|
|
||||||
|
perMainEnabled = true;
|
||||||
|
if (pulsesStarted()) {
|
||||||
|
resumePulses();
|
||||||
|
}
|
||||||
|
resumeMixerCalculations();
|
||||||
|
watchdogSuspend(0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const CliCommand cliCommands[] = {
|
const CliCommand cliCommands[] = {
|
||||||
{ "beep", cliBeep, "[<frequency>] [<duration>]" },
|
{ "beep", cliBeep, "[<frequency>] [<duration>]" },
|
||||||
{ "ls", cliLs, "<directory>" },
|
{ "ls", cliLs, "<directory>" },
|
||||||
@@ -1217,6 +1272,9 @@ const CliCommand cliCommands[] = {
|
|||||||
#endif
|
#endif
|
||||||
#if defined(BLUETOOTH)
|
#if defined(BLUETOOTH)
|
||||||
{ "bt", cliBlueTooth, "<baudrate>|<command>" },
|
{ "bt", cliBlueTooth, "<baudrate>|<command>" },
|
||||||
|
#endif
|
||||||
|
#if defined(ACCESS_DENIED)
|
||||||
|
{ "crypt", cliCrypt, "<string to be encrypted>" },
|
||||||
#endif
|
#endif
|
||||||
{ nullptr, nullptr, nullptr } /* sentinel */
|
{ nullptr, nullptr, nullptr } /* sentinel */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -912,14 +912,15 @@ class ModuleWindow : public FormGroup {
|
|||||||
if (moduleState[moduleIdx].mode == MODULE_MODE_BIND) {
|
if (moduleState[moduleIdx].mode == MODULE_MODE_BIND) {
|
||||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else {
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
else {
|
if (isModuleMultimodule(moduleIdx)) {
|
||||||
setMultiBindStatus(moduleIdx, MULTI_BIND_INITIATED);
|
setMultiBindStatus(moduleIdx, MULTI_BIND_INITIATED);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
moduleState[moduleIdx].mode = MODULE_MODE_BIND;
|
moduleState[moduleIdx].mode = MODULE_MODE_BIND;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
bindButton->setCheckHandler([=]() {
|
bindButton->setCheckHandler([=]() {
|
||||||
@@ -927,7 +928,7 @@ class ModuleWindow : public FormGroup {
|
|||||||
bindButton->check(false);
|
bindButton->check(false);
|
||||||
}
|
}
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
if (getMultiBindStatus(moduleIdx) == MULTI_BIND_FINISHED) {
|
if (isModuleMultimodule(moduleIdx) && getMultiBindStatus(moduleIdx) == MULTI_BIND_FINISHED) {
|
||||||
setMultiBindStatus(moduleIdx, MULTI_BIND_NONE);
|
setMultiBindStatus(moduleIdx, MULTI_BIND_NONE);
|
||||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||||
bindButton->check(false);
|
bindButton->check(false);
|
||||||
@@ -1029,7 +1030,7 @@ class ModuleWindow : public FormGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Receivers
|
// Receivers
|
||||||
if (isModulePXX2(moduleIdx)) {
|
if (isModuleRFAccess(moduleIdx)) {
|
||||||
for (uint8_t receiverIdx = 0; receiverIdx < PXX2_MAX_RECEIVERS_PER_MODULE; receiverIdx++) {
|
for (uint8_t receiverIdx = 0; receiverIdx < PXX2_MAX_RECEIVERS_PER_MODULE; receiverIdx++) {
|
||||||
char label[] = TR_RECEIVER " X";
|
char label[] = TR_RECEIVER " X";
|
||||||
label[sizeof(label) - 2] = '1' + receiverIdx;
|
label[sizeof(label) - 2] = '1' + receiverIdx;
|
||||||
|
|||||||
@@ -522,13 +522,11 @@ extern uint8_t flightModeTransitionLast;
|
|||||||
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint32_t nextMixerTime[NUM_MODULES];
|
|
||||||
|
|
||||||
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
||||||
void evalMixes(uint8_t tick10ms);
|
void evalMixes(uint8_t tick10ms);
|
||||||
void doMixerCalculations();
|
void doMixerCalculations();
|
||||||
void doMixerPeriodicUpdates();
|
void doMixerPeriodicUpdates();
|
||||||
void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms);
|
|
||||||
|
|
||||||
void checkTrims();
|
void checkTrims();
|
||||||
extern uint8_t currentBacklightBright;
|
extern uint8_t currentBacklightBright;
|
||||||
@@ -1328,9 +1326,3 @@ inline bool isAsteriskDisplayed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
|
|
||||||
#if defined(ACCESS_LIB)
|
|
||||||
// TODO should be inside module.h
|
|
||||||
#include "thirdparty/libACCESS/libAccess.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
@@ -329,18 +329,12 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
#if defined(PXX1)
|
#if defined(PXX1)
|
||||||
case PROTOCOL_CHANNELS_PXX1_PULSES:
|
case PROTOCOL_CHANNELS_PXX1_PULSES:
|
||||||
extmodulePulsesData.pxx.setupFrame(EXTERNAL_MODULE);
|
extmodulePulsesData.pxx.setupFrame(EXTERNAL_MODULE);
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX_PULSES_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
|
#if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
|
||||||
case PROTOCOL_CHANNELS_PXX1_SERIAL:
|
case PROTOCOL_CHANNELS_PXX1_SERIAL:
|
||||||
extmodulePulsesData.pxx_uart.setupFrame(EXTERNAL_MODULE);
|
extmodulePulsesData.pxx_uart.setupFrame(EXTERNAL_MODULE);
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, EXTMODULE_PXX1_SERIAL_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -348,32 +342,22 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
||||||
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
|
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
|
||||||
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE);
|
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE);
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SBUS)
|
#if defined(SBUS)
|
||||||
case PROTOCOL_CHANNELS_SBUS:
|
case PROTOCOL_CHANNELS_SBUS:
|
||||||
setupPulsesSbus();
|
setupPulsesSbus();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, SBUS_PERIOD);
|
|
||||||
#else
|
|
||||||
// SBUS_PERIOD is not a constant! It can be set from UI
|
// SBUS_PERIOD is not a constant! It can be set from UI
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DSM2)
|
#if defined(DSM2)
|
||||||
case PROTOCOL_CHANNELS_DSM2_LP45:
|
case PROTOCOL_CHANNELS_DSM2_LP45:
|
||||||
case PROTOCOL_CHANNELS_DSM2_DSM2:
|
case PROTOCOL_CHANNELS_DSM2_DSM2:
|
||||||
case PROTOCOL_CHANNELS_DSM2_DSMX:
|
case PROTOCOL_CHANNELS_DSM2_DSMX:
|
||||||
setupPulsesDSM2();
|
setupPulsesDSM2();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, DSM2_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -386,9 +370,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
else
|
else
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
|
||||||
setupPulsesCrossfire();
|
setupPulsesCrossfire();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -402,9 +383,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
else
|
else
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD);
|
||||||
setupPulsesGhost();
|
setupPulsesGhost();
|
||||||
#if defined(PCBSKPCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, GHOST_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -418,9 +396,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
else
|
else
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
|
||||||
setupPulsesMultiExternalModule();
|
setupPulsesMultiExternalModule();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -428,18 +403,12 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
#if defined(PPM)
|
#if defined(PPM)
|
||||||
case PROTOCOL_CHANNELS_PPM:
|
case PROTOCOL_CHANNELS_PPM:
|
||||||
setupPulsesPPMExternalModule();
|
setupPulsesPPMExternalModule();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, PPM_PERIOD(EXTERNAL_MODULE));
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AFHDS3)
|
#if defined(AFHDS3)
|
||||||
case PROTOCOL_CHANNELS_AFHDS3:
|
case PROTOCOL_CHANNELS_AFHDS3:
|
||||||
extmodulePulsesData.afhds3.setupFrame();
|
extmodulePulsesData.afhds3.setupFrame();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, AFHDS3_COMMAND_TIMEOUT);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "pxx.h"
|
#include "pxx.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
|
||||||
|
#if defined(INTMODULE_HEARTBEAT_GPIO)
|
||||||
struct HeartbeatCapture {
|
struct HeartbeatCapture {
|
||||||
#if !defined(INTMODULE_USART)
|
#if !defined(INTMODULE_USART)
|
||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
@@ -35,6 +36,7 @@ struct HeartbeatCapture {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern volatile HeartbeatCapture heartbeatCapture;
|
extern volatile HeartbeatCapture heartbeatCapture;
|
||||||
|
#endif
|
||||||
|
|
||||||
class Pxx1CrcMixin {
|
class Pxx1CrcMixin {
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ volatile HeartbeatCapture heartbeatCapture;
|
|||||||
|
|
||||||
void init_intmodule_heartbeat()
|
void init_intmodule_heartbeat()
|
||||||
{
|
{
|
||||||
|
TRACE("init_intmodule_heartbeat");
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
@@ -34,7 +35,8 @@ void init_intmodule_heartbeat()
|
|||||||
GPIO_InitStructure.GPIO_Pin = INTMODULE_HEARTBEAT_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = INTMODULE_HEARTBEAT_GPIO_PIN;
|
||||||
GPIO_Init(INTMODULE_HEARTBEAT_GPIO, &GPIO_InitStructure);
|
GPIO_Init(INTMODULE_HEARTBEAT_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
SYSCFG_EXTILineConfig(INTMODULE_HEARTBEAT_EXTI_PortSource, INTMODULE_HEARTBEAT_EXTI_PinSource);
|
SYSCFG_EXTILineConfig(INTMODULE_HEARTBEAT_EXTI_PortSource,
|
||||||
|
INTMODULE_HEARTBEAT_EXTI_PinSource);
|
||||||
|
|
||||||
EXTI_InitTypeDef EXTI_InitStructure;
|
EXTI_InitTypeDef EXTI_InitStructure;
|
||||||
EXTI_StructInit(&EXTI_InitStructure);
|
EXTI_StructInit(&EXTI_InitStructure);
|
||||||
@@ -51,6 +53,7 @@ void init_intmodule_heartbeat()
|
|||||||
|
|
||||||
void stop_intmodule_heartbeat()
|
void stop_intmodule_heartbeat()
|
||||||
{
|
{
|
||||||
|
TRACE("stop_intmodule_heartbeat");
|
||||||
heartbeatCapture.valid = false;
|
heartbeatCapture.valid = false;
|
||||||
|
|
||||||
#if !defined(INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER)
|
#if !defined(INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER)
|
||||||
@@ -69,9 +72,7 @@ void stop_intmodule_heartbeat()
|
|||||||
void check_intmodule_heartbeat()
|
void check_intmodule_heartbeat()
|
||||||
{
|
{
|
||||||
if (EXTI_GetITStatus(INTMODULE_HEARTBEAT_EXTI_LINE) != RESET) {
|
if (EXTI_GetITStatus(INTMODULE_HEARTBEAT_EXTI_LINE) != RESET) {
|
||||||
#if defined(INTMODULE_USART)
|
#if !defined(INTMODULE_USART)
|
||||||
nextMixerTime[INTERNAL_MODULE] = RTOS_GET_MS();
|
|
||||||
#else
|
|
||||||
heartbeatCapture.timestamp = getTmr2MHz();
|
heartbeatCapture.timestamp = getTmr2MHz();
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEBUG_LATENCY)
|
#if defined(DEBUG_LATENCY)
|
||||||
|
|||||||
@@ -202,8 +202,8 @@ if(INTERNAL_MODULE_PXX2)
|
|||||||
add_definitions(-DHARDWARE_INTERNAL_MODULE)
|
add_definitions(-DHARDWARE_INTERNAL_MODULE)
|
||||||
add_definitions(-DINTERNAL_MODULE_PXX2)
|
add_definitions(-DINTERNAL_MODULE_PXX2)
|
||||||
if (NOT PCBREV STREQUAL EXPRESS)
|
if (NOT PCBREV STREQUAL EXPRESS)
|
||||||
set(ACCESS_LIB ON)
|
set(ACCESS_DENIED ON)
|
||||||
add_definitions(-DACCESS_LIB)
|
add_definitions(-DACCESS_DENIED)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -909,6 +909,7 @@
|
|||||||
#define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12
|
#define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12
|
||||||
#define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12
|
#define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12
|
||||||
#define INTMODULE_HEARTBEAT_EXTI_IRQn EXTI15_10_IRQn
|
#define INTMODULE_HEARTBEAT_EXTI_IRQn EXTI15_10_IRQn
|
||||||
|
#define INTMODULE_HEARTBEAT_EXTI_IRQHandler EXTI15_10_IRQHandler
|
||||||
#define INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER
|
#define INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER
|
||||||
#if defined(INTERNAL_MODULE_PXX2)
|
#if defined(INTERNAL_MODULE_PXX2)
|
||||||
#define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Falling
|
#define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Falling
|
||||||
|
|||||||
+4
-23
@@ -127,9 +127,12 @@ void execMixerFrequentActions()
|
|||||||
#if defined(BLUETOOTH)
|
#if defined(BLUETOOTH)
|
||||||
bluetooth.wakeup();
|
bluetooth.wakeup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
DEBUG_TIMER_START(debugTimerTelemetryWakeup);
|
||||||
|
telemetryWakeup();
|
||||||
|
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nextMixerTime[NUM_MODULES];
|
|
||||||
|
|
||||||
TASK_FUNCTION(mixerTask)
|
TASK_FUNCTION(mixerTask)
|
||||||
{
|
{
|
||||||
@@ -212,10 +215,6 @@ TASK_FUNCTION(mixerTask)
|
|||||||
usbJoystickUpdate();
|
usbJoystickUpdate();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUG_TIMER_START(debugTimerTelemetryWakeup);
|
|
||||||
telemetryWakeup();
|
|
||||||
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
|
|
||||||
|
|
||||||
if (heartbeat == HEART_WDT_CHECK) {
|
if (heartbeat == HEART_WDT_CHECK) {
|
||||||
WDG_RESET();
|
WDG_RESET();
|
||||||
heartbeat = 0;
|
heartbeat = 0;
|
||||||
@@ -232,24 +231,6 @@ TASK_FUNCTION(mixerTask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms)
|
|
||||||
{
|
|
||||||
// Schedule next mixer calculation time,
|
|
||||||
|
|
||||||
if (isModuleSynchronous(module)) {
|
|
||||||
nextMixerTime[module] += period_ms / RTOS_MS_PER_TICK;
|
|
||||||
if (nextMixerTime[module] < RTOS_GET_TIME()) {
|
|
||||||
// we are late ... let's add some small delay
|
|
||||||
nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// for now assume mixer calculation takes 2 ms.
|
|
||||||
nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms
|
#define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,14 @@ void processTelemetryFrame(uint8_t module, const uint8_t * frame)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ACCESS_LIB) && !defined(SIMU)
|
#if defined(INTERNAL_MODULE_PXX2) && defined(ACCESS_DENIED) && !defined(SIMU)
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "AccessDenied/access_denied.h"
|
||||||
|
};
|
||||||
|
|
||||||
|
volatile int16_t authenticateFrames = 0;
|
||||||
|
|
||||||
void processAuthenticationFrame(uint8_t module, const uint8_t * frame)
|
void processAuthenticationFrame(uint8_t module, const uint8_t * frame)
|
||||||
{
|
{
|
||||||
uint8_t cryptoType = frame[3];
|
uint8_t cryptoType = frame[3];
|
||||||
@@ -228,15 +235,21 @@ void processAuthenticationFrame(uint8_t module, const uint8_t * frame)
|
|||||||
globalData.upgradeModulePopup = 1;
|
globalData.upgradeModulePopup = 1;
|
||||||
POPUP_INFORMATION(STR_AUTH_FAILURE);
|
POPUP_INFORMATION(STR_AUTH_FAILURE);
|
||||||
}
|
}
|
||||||
|
TRACE("[authFailed]\r\n", authenticateFrames);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (INTERNAL_MODULE == module && accessCRL(cryptoType, frame+4, messageDigest)) {
|
if (INTERNAL_MODULE == module &&
|
||||||
|
access_denied(cryptoType, frame + 4, messageDigest)) {
|
||||||
moduleState[module].mode = MODULE_MODE_AUTHENTICATION;
|
moduleState[module].mode = MODULE_MODE_AUTHENTICATION;
|
||||||
Pxx2Pulses & pxx2 = intmodulePulsesData.pxx2;
|
Pxx2Pulses &pxx2 = intmodulePulsesData.pxx2;
|
||||||
pxx2.setupAuthenticationFrame(module, cryptoType, (const uint8_t *)messageDigest);
|
pxx2.setupAuthenticationFrame(module, cryptoType,
|
||||||
|
(const uint8_t *)messageDigest);
|
||||||
intmoduleSendBuffer(pxx2.getData(), pxx2.getSize());
|
intmoduleSendBuffer(pxx2.getData(), pxx2.getSize());
|
||||||
// we remain in AUTHENTICATION mode to avoid a CHANNELS frame is sent at the end of the mixing process
|
// we remain in AUTHENTICATION mode to avoid a CHANNELS frame is sent at the
|
||||||
|
// end of the mixing process
|
||||||
|
authenticateFrames++;
|
||||||
|
TRACE("[authFrame %d]\r\n", authenticateFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!globalData.upgradeModulePopup) {
|
if (!globalData.upgradeModulePopup) {
|
||||||
@@ -249,6 +262,7 @@ void processAuthenticationFrame(uint8_t module, const uint8_t * frame)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define processAuthenticationFrame(module, frame)
|
#define processAuthenticationFrame(module, frame)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
Submodule radio/src/thirdparty/AccessDenied added at 6b04dfe4d9
Vendored
-1
Submodule radio/src/thirdparty/libACCESS deleted from 63802e6d50
Reference in New Issue
Block a user