From 7bfb213687c6af888d0426a26e10238762b5d582 Mon Sep 17 00:00:00 2001 From: 3djc Date: Sat, 17 Sep 2016 08:53:01 +0200 Subject: [PATCH] Allow sdcard version change from cmake (#3816) * Allow sdcard version change from cmake * Make it sdcard version check ARM only * Move to common ARM --- CMakeLists.txt | 5 +++++ radio/sdcard/horus/opentx.sdcard.version | 2 +- radio/sdcard/taranis/opentx.sdcard.version | 2 +- radio/src/dataconstants.h | 7 ++----- radio/src/opentx.cpp | 16 ++++++++-------- radio/src/targets/common/arm/CMakeLists.txt | 1 + tools/nightly22/build-nightly.sh | 6 +++--- 7 files changed, 21 insertions(+), 18 deletions(-) mode change 100755 => 100644 radio/sdcard/horus/opentx.sdcard.version mode change 100755 => 100644 radio/sdcard/taranis/opentx.sdcard.version diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b775bbc8..23934e828 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,11 @@ set(VERSION_FAMILY ${VERSION_MAJOR}.${VERSION_MINOR}) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_SUFFIX}) message(STATUS "OpenTX ${VERSION}") +set(SDCARD_REVISION "0002") +set(SDCARD_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}V${SDCARD_REVISION}) +file(WRITE radio/sdcard/horus/opentx.sdcard.version ${SDCARD_VERSION}) +file(WRITE radio/sdcard/taranis/opentx.sdcard.version ${SDCARD_VERSION}) + cmake_minimum_required(VERSION 2.8) cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0023 OLD) diff --git a/radio/sdcard/horus/opentx.sdcard.version b/radio/sdcard/horus/opentx.sdcard.version old mode 100755 new mode 100644 index cd7eff026..ee89d6bb7 --- a/radio/sdcard/horus/opentx.sdcard.version +++ b/radio/sdcard/horus/opentx.sdcard.version @@ -1 +1 @@ -2.2V0002 +2.2V0002 \ No newline at end of file diff --git a/radio/sdcard/taranis/opentx.sdcard.version b/radio/sdcard/taranis/opentx.sdcard.version old mode 100755 new mode 100644 index cd7eff026..ee89d6bb7 --- a/radio/sdcard/taranis/opentx.sdcard.version +++ b/radio/sdcard/taranis/opentx.sdcard.version @@ -1 +1 @@ -2.2V0002 +2.2V0002 \ No newline at end of file diff --git a/radio/src/dataconstants.h b/radio/src/dataconstants.h index 0cbf436f5..c5cc4651d 100644 --- a/radio/src/dataconstants.h +++ b/radio/src/dataconstants.h @@ -124,15 +124,12 @@ #define NUM_CYC 3 #define NUM_CAL_PPM 4 -#if defined(SDCARD) -#define REQUIRED_SDCARD_VERSION "2.2V0001" -#endif enum CurveType { CURVE_TYPE_STANDARD, CURVE_TYPE_CUSTOM, CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM }; - + #if defined(CPUARM) #define MIN_POINTS_PER_CURVE 3 #else @@ -729,7 +726,7 @@ enum MixSources { MIXSRC_FIRST_INPUT, LUA_EXPORT_MULTIPLE("input", "Input [I%d]", MAX_INPUTS) MIXSRC_LAST_INPUT = MIXSRC_FIRST_INPUT+MAX_INPUTS-1, #endif - + #if defined(LUA_INPUTS) MIXSRC_FIRST_LUA, MIXSRC_LAST_LUA = MIXSRC_FIRST_LUA+(MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)-1, diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 390c73654..95ae73cb9 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -980,7 +980,7 @@ void doSplash() #define doSplash() #endif -#if defined(SDCARD) +#if defined(SDCARD) && defined(CPUARM) void checkSDVersion() { if (sdMounted()) { @@ -1038,7 +1038,7 @@ void checkAll() checkFailsafe(); #endif -#if defined(SDCARD) +#if defined(SDCARD) && defined(CPUARM) checkSDVersion(); #endif @@ -1877,7 +1877,7 @@ void opentxClose(uint8_t shutdown) hapticOff(); #endif } - + #if defined(SDCARD) logsClose(); #endif @@ -1919,21 +1919,21 @@ void opentxClose(uint8_t shutdown) void opentxResume() { TRACE("opentxResume"); - + menuHandlers[0] = menuMainView; - + sdMount(); - + storageReadAll(); #if defined(PCBHORUS) loadTheme(); loadFontCache(); #endif - + opentxStart(false); -#if defined(CPUARM) +#if defined(CPUARM) referenceSystemAudioFiles(); #endif diff --git a/radio/src/targets/common/arm/CMakeLists.txt b/radio/src/targets/common/arm/CMakeLists.txt index 323524112..414ef62b7 100644 --- a/radio/src/targets/common/arm/CMakeLists.txt +++ b/radio/src/targets/common/arm/CMakeLists.txt @@ -75,6 +75,7 @@ endif() add_definitions(-DCPUARM -DVIRTUAL_INPUTS) add_definitions(-DTELEMETRY_FRSKY -DTELEMETRY_FRSKY_SPORT -DFRSKY_HUB -DGPS -DPXX -DDSM2) add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE -DGAUGES) +add_definitions(-DREQUIRED_SDCARD_VERSION="${SDCARD_VERSION}") include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable) foreach(LANGUAGE ${TTS_LANGUAGES}) set(SRC ${SRC} translations/tts_${LANGUAGE}.cpp) diff --git a/tools/nightly22/build-nightly.sh b/tools/nightly22/build-nightly.sh index 1ba46cd97..03d37f3b8 100755 --- a/tools/nightly22/build-nightly.sh +++ b/tools/nightly22/build-nightly.sh @@ -16,9 +16,6 @@ suffix="N$index" cd ${workdir} -# Call sdcard generation -# code/tools/nightly22/build-sdcard.sh - # Create on-demand build environment cp code/radio/util/Dockerfile . docker build -t new-$docker --build-arg OPENTX_VERSION_SUFFIX=$suffix . @@ -26,6 +23,9 @@ docker rmi $docker || true docker tag new-$docker $docker docker rmi new-$docker +# Call sdcard generation +code/tools/nightly22/build-sdcard.sh + # Build Linux companion docker run -dit --name companion -v /home/opentx/$docker:/opentx $docker docker exec companion sh -c "mkdir -p build && cd build && cmake /opentx/code && cp radio/src/stamp.h /opentx/binaries/stamp-opentx.txt"