diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d7218ed860..d730344f3bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: path: targets.txt build-SITL-Linux-arm64: - runs-on: ubuntu-24.04-arm + runs-on: ubuntu-22.04-arm steps: - uses: actions/checkout@v4 - name: Install dependencies @@ -130,6 +130,11 @@ jobs: echo "NUM_CORES=$(grep processor /proc/cpuinfo | wc -l)" >> $GITHUB_ENV - name: Build SITL run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j${{ env.NUM_CORES }} + - name: Strip version number + run: | + for f in build_SITL/*_SITL; do + mv $f $(echo $f | sed -e 's/_[0-9]\+\.[0-9]\+\.[0-9]\+//') + done - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -161,6 +166,11 @@ jobs: echo "NUM_CORES=$(grep processor /proc/cpuinfo | wc -l)" >> $GITHUB_ENV - name: Build SITL run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j${{ env.NUM_CORES }} + - name: Strip version number + run: | + for f in build_SITL/*_SITL; do + mv $f $(echo $f | sed -e 's/_[0-9]\+\.[0-9]\+\.[0-9]\+//') + done - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -197,7 +207,11 @@ jobs: mkdir -p build_SITL && cd build_SITL cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -G Ninja .. ninja -j4 - + - name: Strip version number + run: | + for f in build_SITL/*_SITL; do + mv -v $f $(echo $f | sed -Ee 's/_[0-9]+\.[0-9]+\.[0-9]+//') + done - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -234,13 +248,17 @@ jobs: - name: Build SITL run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja -j4 + - name: Strip version number + run: | + for f in ./build_SITL/*_SITL.exe; do + mv $f $(echo $f | sed -e 's/_[0-9]\+\.[0-9]\+\.[0-9]\+//') + done - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: ${{ env.BUILD_NAME }}_SITL-WIN path: ./build_SITL/*.exe - test: #needs: [build] runs-on: ubuntu-latest diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 9e9d68fa0d3..89b5f7dd40c 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -44,13 +44,13 @@ jobs: uses: actions/download-artifact@v4 with: path: resources/sitl/linux - pattern: inav-*SITIL-Linux + pattern: inav-*SITL-Linux merge-multiple: true - name: download sitl linux aarch64 uses: actions/download-artifact@v4 with: path: resources/sitl/linux/arm64 - pattern: inav-*SITIL-Linux-aarch64 + pattern: inav-*SITL-Linux-aarch64 merge-multiple: true - name: download sitl windows uses: actions/download-artifact@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5f40f3337..82c242ca8b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ else() endif() endif() -project(INAV VERSION 8.0.0) +project(INAV VERSION 9.0.0) enable_language(ASM) diff --git a/readme.md b/readme.md index 5107d4661ea..e52b7b70ff9 100644 --- a/readme.md +++ b/readme.md @@ -1,18 +1,10 @@ -# INAV 8.0 feature freeze - -It is that time of the year again, and the time for a new INAV release is near! - -The current plan is to have a feature freeze on **15th of November 2024**. - -For a preview of what is comming, have a look at ![milestone 8.0](https://github.com/iNavFlight/inav/milestone/43). - # INAV - navigation capable flight controller # F411 PSA > INAV no longer accepts targets based on STM32 F411 MCU. -> INAV 7 is the last INAV official release available for F411 based flight controllers. The next milestone, INAV 8 will not be available for F411 boards. +> INAV 7 was the last INAV official release available for F411 based flight controllers. INAV 8 is not officially available for F411 boards. # ICM426xx IMUs PSA diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index eaca5eb2608..62697014c31 100644 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -2803,11 +2803,11 @@ static void osdCustom(char *cmdline){ int32_t i = args[INDEX]; if ( i >= 0 && i < MAX_CUSTOM_ELEMENTS && - args[PART0_TYPE] >= 0 && args[PART0_TYPE] <= 26 && + args[PART0_TYPE] >= 0 && args[PART0_TYPE] < CUSTOM_ELEMENT_TYPE_END && args[PART0_VALUE] >= 0 && args[PART0_VALUE] <= UINT8_MAX && - args[PART1_TYPE] >= 0 && args[PART1_TYPE] <= 26 && + args[PART1_TYPE] >= 0 && args[PART1_TYPE] < CUSTOM_ELEMENT_TYPE_END && args[PART1_VALUE] >= 0 && args[PART1_VALUE] <= UINT8_MAX && - args[PART2_TYPE] >= 0 && args[PART2_TYPE] <= 26 && + args[PART2_TYPE] >= 0 && args[PART2_TYPE] < CUSTOM_ELEMENT_TYPE_END && args[PART2_VALUE] >= 0 && args[PART2_VALUE] <= UINT8_MAX && args[VISIBILITY_TYPE] >= 0 && args[VISIBILITY_TYPE] <= 2 && args[VISIBILITY_VALUE] >= 0 && args[VISIBILITY_VALUE] <= UINT8_MAX diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 0125b4ce914..b4b6fce2824 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -3520,7 +3520,11 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src) sbufReadU8Safe(&tmp_u8, src); if ((dataSize == (OSD_CUSTOM_ELEMENT_TEXT_SIZE - 1) + (CUSTOM_ELEMENTS_PARTS * 3) + 4) && (tmp_u8 < MAX_CUSTOM_ELEMENTS)) { for (int i = 0; i < CUSTOM_ELEMENTS_PARTS; i++) { - osdCustomElementsMutable(tmp_u8)->part[i].type = sbufReadU8(src); + uint8_t type = sbufReadU8(src); + if (type >= CUSTOM_ELEMENT_TYPE_END) + return MSP_RESULT_ERROR; + + osdCustomElementsMutable(tmp_u8)->part[i].type = type; osdCustomElementsMutable(tmp_u8)->part[i].value = sbufReadU16(src); } osdCustomElementsMutable(tmp_u8)->visibility.type = sbufReadU8(src); diff --git a/src/main/io/displayport_msp_dji_compat.c b/src/main/io/displayport_msp_dji_compat.c index 74805fa0598..8daffbb4d15 100644 --- a/src/main/io/displayport_msp_dji_compat.c +++ b/src/main/io/displayport_msp_dji_compat.c @@ -27,10 +27,10 @@ #include // 0123456789 -static char *dji_logo = " DJI, FIX " - " THE OSD " - " FOR O3 " - " AND O4 "; +static char *dji_logo = " DJI, " + " PLEASE " + " FIX YOUR " + " OSD FONT "; uint8_t getDJICharacter(uint8_t ch, uint8_t page) { @@ -57,7 +57,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) return DJI_SYM_RSSI; case SYM_LQ: - return 'Q'; + return DJI_SYM_LINK_QUALITY; case SYM_LAT: return DJI_SYM_LAT; @@ -142,13 +142,13 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_MAH: return DJI_SYM_MAH; +/* + case SYM_AH_KM: // AH / KM + return '?'; - case SYM_AH_KM: - return 'K'; + case SYM_AH_MI: // AH / MI + return '?'; - case SYM_AH_MI: - return 'M'; -/* case SYM_VTX_POWER: return DJI_SYM_VTX_POWER; @@ -225,8 +225,9 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) return DJI_SYM_M; case SYM_TOTAL: - return DJI_SYM_FLY_H; -/* + return DJI_SYM_TOTAL_DISTANCE; + + /* case SYM_ALT_KM: return DJI_SYM_ALT_KM; @@ -249,20 +250,22 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_DIST_NM: return DJI_SYM_DIST_NM; */ + case SYM_M: return DJI_SYM_M; case SYM_KM: - return 'K'; + return DJI_SYM_KM; case SYM_MI: - return 'M'; + return DJI_SYM_MILES; + /* case SYM_NM: return DJI_SYM_NM; -*/ case SYM_WIND_HORIZONTAL: return 'W'; // W for wind + */ /* case SYM_WIND_VERTICAL: @@ -270,7 +273,8 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_3D_KT: return DJI_SYM_3D_KT; -*/ + */ +/* case SYM_AIR: return 'A'; // A for airspeed @@ -279,7 +283,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_3D_MPH: return DJI_SYM_MPH; - + */ case SYM_RPM: return DJI_SYM_RPM; @@ -288,7 +292,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) /* case SYM_100FTM: return DJI_SYM_100FTM; -*/ + */ case SYM_MS: return DJI_SYM_MPS; @@ -306,7 +310,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_MAH_MI_1: return DJI_SYM_MAH_MI_1; -*/ + */ case SYM_THR: return DJI_SYM_THR; @@ -319,11 +323,13 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_BLANK: return DJI_SYM_BLANK; +/* case SYM_ON_H: return DJI_SYM_ON_H; case SYM_FLY_H: return DJI_SYM_FLY_H; + */ case SYM_ON_M: return DJI_SYM_ON_M; @@ -345,7 +351,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_ZERO_HALF_LEADING_DOT: return DJI_SYM_ZERO_HALF_LEADING_DOT; -*/ + */ case SYM_AUTO_THR0: return 'A'; @@ -380,7 +386,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_GFORCE_Z: return DJI_SYM_GFORCE_Z; -*/ + */ case SYM_BARO_TEMP: return DJI_SYM_TEMPERATURE; @@ -401,7 +407,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case TEMP_SENSOR_SYM_COUNT: return DJI_TEMP_SENSOR_SYM_COUNT; -*/ + */ case SYM_HEADING_N: return DJI_SYM_HEADING_N; @@ -425,7 +431,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) /* case SYM_PROFILE: return DJI_SYM_PROFILE; -*/ + */ case SYM_SWITCH_INDICATOR_LOW: return DJI_SYM_STICK_OVERLAY_SPRITE_LOW; @@ -467,7 +473,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_CROSS_TRACK_ERROR: return DJI_SYM_CROSS_TRACK_ERROR; -*/ + */ case SYM_AH_LEFT: return DJI_SYM_AH_LEFT; @@ -477,16 +483,17 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) /* case SYM_AH_DECORATION_COUNT: return DJI_SYM_AH_DECORATION_COUNT; -*/ + */ + case SYM_AH_CH_LEFT: case SYM_AH_CH_AIRCRAFT1: - return DJI_SYM_CROSSHAIR_LEFT; + return DJI_SYM_AH_CENTER_LINE; case SYM_AH_CH_CENTER: case SYM_AH_CH_AIRCRAFT2: - return DJI_SYM_CROSSHAIR_CENTRE; + return DJI_SYM_AH_CENTER; case SYM_AH_CH_RIGHT: case SYM_AH_CH_AIRCRAFT3: - return DJI_SYM_CROSSHAIR_RIGHT; + return DJI_SYM_AH_CENTER_LINE_RIGHT; case SYM_AH_CH_AIRCRAFT0: case SYM_AH_CH_AIRCRAFT4: @@ -495,21 +502,21 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_AH_CH_TYPE3: return DJI_SYM_NONE; case (SYM_AH_CH_TYPE3+1): - return DJI_SYM_SMALL_CROSSHAIR; + return DJI_SYM_AH_CENTER; case (SYM_AH_CH_TYPE3+2): return DJI_SYM_NONE; case SYM_AH_CH_TYPE4: return DJI_SYM_HYPHEN; case (SYM_AH_CH_TYPE4+1): - return DJI_SYM_SMALL_CROSSHAIR; + return DJI_SYM_AH_CENTER; case (SYM_AH_CH_TYPE4+2): return DJI_SYM_HYPHEN; case SYM_AH_CH_TYPE5: return DJI_SYM_STICK_OVERLAY_HORIZONTAL; case (SYM_AH_CH_TYPE5+1): - return DJI_SYM_SMALL_CROSSHAIR; + return DJI_SYM_AH_CENTER; case (SYM_AH_CH_TYPE5+2): return DJI_SYM_STICK_OVERLAY_HORIZONTAL; @@ -523,14 +530,14 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_AH_CH_TYPE7: return DJI_SYM_ARROW_SMALL_LEFT; case (SYM_AH_CH_TYPE7+1): - return DJI_SYM_SMALL_CROSSHAIR; + return DJI_SYM_AH_CENTER; case (SYM_AH_CH_TYPE7+2): return DJI_SYM_ARROW_SMALL_RIGHT; case SYM_AH_CH_TYPE8: return DJI_SYM_AH_LEFT; case (SYM_AH_CH_TYPE8+1): - return DJI_SYM_SMALL_CROSSHAIR; + return DJI_SYM_AH_CENTER; case (SYM_AH_CH_TYPE8+2): return DJI_SYM_AH_RIGHT; @@ -690,7 +697,7 @@ uint8_t getDJICharacter(uint8_t ch, uint8_t page) case SYM_FLIGHT_DIST_REMAINING: return DJI_SYM_FLIGHT_DIST_REMAINING; -*/ + */ case SYM_HUD_ARROWS_L1: return DJI_SYM_ARROW_SMALL_LEFT; diff --git a/src/main/io/dji_osd_symbols.h b/src/main/io/dji_osd_symbols.h index 83ccad7c82d..7c63eedb645 100644 --- a/src/main/io/dji_osd_symbols.h +++ b/src/main/io/dji_osd_symbols.h @@ -38,21 +38,25 @@ #define DJI_SYM_LAT 0x89 #define DJI_SYM_LON 0x98 #define DJI_SYM_ALTITUDE 0x7F +#define DJI_SYM_TOTAL_DISTANCE 0x71 #define DJI_SYM_OVER_HOME 0x05 // RSSI #define DJI_SYM_RSSI 0x01 +#define DJI_SYM_LINK_QUALITY 0x7B // Throttle Position (%) #define DJI_SYM_THR 0x04 // Unit Icons (Metric) #define DJI_SYM_M 0x0C +#define DJI_SYM_KM 0x7D #define DJI_SYM_C 0x0E // Unit Icons (Imperial) -#define DJI_SYM_F 0x0D #define DJI_SYM_FT 0x0F +#define DJI_SYM_MILES 0x7E +#define DJI_SYM_F 0x0D // Heading Graphics #define DJI_SYM_HEADING_N 0x18 @@ -63,13 +67,12 @@ #define DJI_SYM_HEADING_LINE 0x1D // AH Center screen Graphics -#define DJI_SYM_CROSSHAIR_LEFT 0x72 -#define DJI_SYM_CROSSHAIR_CENTRE 0x73 -#define DJI_SYM_CROSSHAIR_RIGHT 0x74 +#define DJI_SYM_AH_CENTER_LINE 0x72 +#define DJI_SYM_AH_CENTER 0x73 +#define DJI_SYM_AH_CENTER_LINE_RIGHT 0x74 #define DJI_SYM_AH_RIGHT 0x02 #define DJI_SYM_AH_LEFT 0x03 #define DJI_SYM_AH_DECORATION 0x13 -#define DJI_SYM_SMALL_CROSSHAIR 0x7E // Satellite Graphics #define DJI_SYM_SAT_L 0x1E @@ -136,17 +139,19 @@ #define DJI_SYM_WATT 0x57 // 0x57 is 'W' // Time -#define DJI_SYM_ON_H 0x70 -#define DJI_SYM_FLY_H 0x71 #define DJI_SYM_ON_M 0x9B #define DJI_SYM_FLY_M 0x9C // Speed +#define DJI_SYM_SPEED 0x70 #define DJI_SYM_KPH 0x9E #define DJI_SYM_MPH 0x9D #define DJI_SYM_MPS 0x9F #define DJI_SYM_FTPS 0x99 +// Menu cursor +#define DJI_SYM_CURSOR DJI_SYM_AH_LEFT + // Stick overlays #define DJI_SYM_STICK_OVERLAY_SPRITE_HIGH 0x08 #define DJI_SYM_STICK_OVERLAY_SPRITE_MID 0x09 diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 59f156ac1e5..d44ea0a8988 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -486,12 +486,13 @@ static void osdFormatWindSpeedStr(char *buff, int32_t ws, bool isValid) */ void osdFormatAltitudeSymbol(char *buff, int32_t alt) { - uint8_t digits = osdConfig()->decimals_altitude; - uint8_t totalDigits = digits + 1; - uint8_t symbolIndex = digits + 1; + uint8_t digits = osdConfig()->decimals_altitude + 1; + uint8_t totalDigits = digits; + uint8_t symbolIndex = digits; uint8_t symbolKFt = SYM_ALT_KFT; if (alt >= 0) { + digits--; buff[0] = ' '; } diff --git a/src/main/io/osd/custom_elements.c b/src/main/io/osd/custom_elements.c index df84ddd76b0..15dc8714c9f 100644 --- a/src/main/io/osd/custom_elements.c +++ b/src/main/io/osd/custom_elements.c @@ -98,6 +98,11 @@ uint8_t customElementDrawPart(char *buff, uint8_t customElementIndex, uint8_t cu osdFormatCentiNumber(buff, (int32_t) (constrain(gvGet(customPartValue), -99, 99) * (int32_t) 10), 1, 1, 0, 3, false); return 3; } + case CUSTOM_ELEMENT_TYPE_GV_FLOAT_1_2: + { + osdFormatCentiNumber(buff, (int32_t) (constrain(gvGet(customPartValue), -999, 999)), 1, 2, 0, 4, false); + return 4; + } case CUSTOM_ELEMENT_TYPE_GV_FLOAT_2_1: { osdFormatCentiNumber(buff, (int32_t) (constrain(gvGet(customPartValue), -999, 999) * (int32_t) 10), 1, 1, 0, 4, false); @@ -154,6 +159,11 @@ uint8_t customElementDrawPart(char *buff, uint8_t customElementIndex, uint8_t cu osdFormatCentiNumber(buff, (int32_t) (constrain(logicConditionGetValue(customPartValue), -99, 99) * (int32_t) 10), 1, 1, 0, 3, false); return 3; } + case CUSTOM_ELEMENT_TYPE_LC_FLOAT_1_2: + { + osdFormatCentiNumber(buff, (int32_t) (constrain(logicConditionGetValue(customPartValue), -999, 999)), 1, 2, 0, 4, false); + return 4; + } case CUSTOM_ELEMENT_TYPE_LC_FLOAT_2_1: { osdFormatCentiNumber(buff, (int32_t) (constrain(logicConditionGetValue(customPartValue), -999, 999) * (int32_t) 10), 1, 1, 0, 4, false); diff --git a/src/main/io/osd/custom_elements.h b/src/main/io/osd/custom_elements.h index 9c12ede6734..8f5ee158811 100644 --- a/src/main/io/osd/custom_elements.h +++ b/src/main/io/osd/custom_elements.h @@ -35,22 +35,25 @@ typedef enum { CUSTOM_ELEMENT_TYPE_GV_4 = 8, CUSTOM_ELEMENT_TYPE_GV_5 = 9, CUSTOM_ELEMENT_TYPE_GV_FLOAT_1_1 = 10, - CUSTOM_ELEMENT_TYPE_GV_FLOAT_2_1 = 11, - CUSTOM_ELEMENT_TYPE_GV_FLOAT_2_2 = 12, - CUSTOM_ELEMENT_TYPE_GV_FLOAT_3_1 = 13, - CUSTOM_ELEMENT_TYPE_GV_FLOAT_3_2 = 14, - CUSTOM_ELEMENT_TYPE_GV_FLOAT_4_1 = 15, - CUSTOM_ELEMENT_TYPE_LC_1 = 16, - CUSTOM_ELEMENT_TYPE_LC_2 = 17, - CUSTOM_ELEMENT_TYPE_LC_3 = 18, - CUSTOM_ELEMENT_TYPE_LC_4 = 19, - CUSTOM_ELEMENT_TYPE_LC_5 = 20, - CUSTOM_ELEMENT_TYPE_LC_FLOAT_1_1 = 21, - CUSTOM_ELEMENT_TYPE_LC_FLOAT_2_1 = 22, - CUSTOM_ELEMENT_TYPE_LC_FLOAT_2_2 = 23, - CUSTOM_ELEMENT_TYPE_LC_FLOAT_3_1 = 24, - CUSTOM_ELEMENT_TYPE_LC_FLOAT_3_2 = 25, - CUSTOM_ELEMENT_TYPE_LC_FLOAT_4_1 = 26, + CUSTOM_ELEMENT_TYPE_GV_FLOAT_1_2 = 11, + CUSTOM_ELEMENT_TYPE_GV_FLOAT_2_1 = 12, + CUSTOM_ELEMENT_TYPE_GV_FLOAT_2_2 = 13, + CUSTOM_ELEMENT_TYPE_GV_FLOAT_3_1 = 14, + CUSTOM_ELEMENT_TYPE_GV_FLOAT_3_2 = 15, + CUSTOM_ELEMENT_TYPE_GV_FLOAT_4_1 = 16, + CUSTOM_ELEMENT_TYPE_LC_1 = 17, + CUSTOM_ELEMENT_TYPE_LC_2 = 18, + CUSTOM_ELEMENT_TYPE_LC_3 = 19, + CUSTOM_ELEMENT_TYPE_LC_4 = 20, + CUSTOM_ELEMENT_TYPE_LC_5 = 21, + CUSTOM_ELEMENT_TYPE_LC_FLOAT_1_1 = 22, + CUSTOM_ELEMENT_TYPE_LC_FLOAT_1_2 = 23, + CUSTOM_ELEMENT_TYPE_LC_FLOAT_2_1 = 24, + CUSTOM_ELEMENT_TYPE_LC_FLOAT_2_2 = 25, + CUSTOM_ELEMENT_TYPE_LC_FLOAT_3_1 = 26, + CUSTOM_ELEMENT_TYPE_LC_FLOAT_3_2 = 27, + CUSTOM_ELEMENT_TYPE_LC_FLOAT_4_1 = 28, + CUSTOM_ELEMENT_TYPE_END // Must be last } osdCustomElementType_e; typedef enum { diff --git a/src/main/sensors/battery.c b/src/main/sensors/battery.c index a29fa2e07cf..e9167e09120 100644 --- a/src/main/sensors/battery.c +++ b/src/main/sensors/battery.c @@ -351,16 +351,23 @@ static void checkBatteryCapacityState(void) void batteryUpdate(timeUs_t timeDelta) { + static timeUs_t batteryConnectedTime = 0; /* battery has just been connected*/ if (batteryState == BATTERY_NOT_PRESENT && vbat > VBATT_PRESENT_THRESHOLD) { + if(batteryConnectedTime == 0) { + batteryConnectedTime = micros(); + return; + } - /* Actual battery state is calculated below, this is really BATTERY_PRESENT */ - batteryState = BATTERY_OK; /* wait for VBatt to stabilise then we can calc number of cells (using the filtered value takes a long time to ramp up) - We only do this on the ground so don't care if we do block, not - worse than original code anyway*/ - delay(VBATT_STABLE_DELAY); + Blocking can cause issues with some ESCs */ + if((micros() - batteryConnectedTime) < VBATT_STABLE_DELAY) { + return; + } + + /* Actual battery state is calculated below, this is really BATTERY_PRESENT */ + batteryState = BATTERY_OK; updateBatteryVoltage(timeDelta, true); int8_t detectedProfileIndex = -1; @@ -396,6 +403,7 @@ void batteryUpdate(timeUs_t timeDelta) /* battery has been disconnected - can take a while for filter cap to disharge so we use a threshold of VBATT_PRESENT_THRESHOLD */ if (batteryState != BATTERY_NOT_PRESENT && vbat <= VBATT_PRESENT_THRESHOLD) { batteryState = BATTERY_NOT_PRESENT; + batteryConnectedTime = 0; batteryCellCount = 0; batteryWarningVoltage = 0; batteryCriticalVoltage = 0; diff --git a/src/main/target/AETH743Basic/CMakeLists.txt b/src/main/target/AETH743Basic/CMakeLists.txt new file mode 100644 index 00000000000..f70f3feb42f --- /dev/null +++ b/src/main/target/AETH743Basic/CMakeLists.txt @@ -0,0 +1 @@ +target_stm32h743xi(AETH743Basic) diff --git a/src/main/target/AETH743Basic/config.c b/src/main/target/AETH743Basic/config.c new file mode 100644 index 00000000000..6e8b9605129 --- /dev/null +++ b/src/main/target/AETH743Basic/config.c @@ -0,0 +1,36 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Cleanflight is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cleanflight. If not, see . + */ + +#include + +#include "platform.h" + +#include "fc/fc_msp_box.h" +#include "fc/config.h" + +#include "io/piniobox.h" +#include "io/serial.h" + + +void targetConfiguration(void) +{ + pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; + pinioBoxConfigMutable()->permanentId[1] = BOX_PERMANENT_ID_USER2; + serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART7)].functionMask = FUNCTION_MSP; + serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART7)].msp_baudrateIndex = BAUD_115200; + beeperConfigMutable()->pwmMode = true; +} diff --git a/src/main/target/AETH743Basic/target.c b/src/main/target/AETH743Basic/target.c new file mode 100644 index 00000000000..4a18ed15694 --- /dev/null +++ b/src/main/target/AETH743Basic/target.c @@ -0,0 +1,53 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + +#include + +#include "platform.h" + +#include "drivers/bus.h" +#include "drivers/io.h" +#include "drivers/pwm_mapping.h" +#include "drivers/timer.h" +#include "drivers/pinio.h" +#include "drivers/sensor.h" + +BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_0, DEVHW_ICM42605, ICM42688_0_SPI_BUS, ICM42688_0_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_ICM42688_0_ALIGN); +BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_1, DEVHW_ICM42605, ICM42688_1_SPI_BUS, ICM42688_1_CS_PIN, NONE, 2, DEVFLAGS_NONE, IMU_ICM42688_1_ALIGN); + +timerHardware_t timerHardware[] = { + DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 1), // S2 + + DEF_TIM(TIM5, CH1, PA0, TIM_USE_OUTPUT_AUTO, 0, 2), // S3 + DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 3), // S4 + DEF_TIM(TIM5, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 4), // S5 + DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 5), // S6 + + DEF_TIM(TIM4, CH1, PD12, TIM_USE_OUTPUT_AUTO, 0, 6), // S7 + DEF_TIM(TIM4, CH2, PD13, TIM_USE_OUTPUT_AUTO, 0, 7), // S8 + DEF_TIM(TIM4, CH3, PD14, TIM_USE_OUTPUT_AUTO, 0, 0), // S9 + DEF_TIM(TIM4, CH4, PD15, TIM_USE_OUTPUT_AUTO, 0, 0), // S10 DMA_NONE + + DEF_TIM(TIM15, CH1, PE5, TIM_USE_OUTPUT_AUTO, 0, 0), // S11 + DEF_TIM(TIM15, CH2, PE6, TIM_USE_OUTPUT_AUTO, 0, 0), // S12 DMA_NONE + + DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0, 9), // LED_2812 + DEF_TIM(TIM2, CH1, PA15, TIM_USE_BEEPER, 0, 0), // BEEPER PWM +}; + +const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]); diff --git a/src/main/target/AETH743Basic/target.h b/src/main/target/AETH743Basic/target.h new file mode 100644 index 00000000000..2271ae621cf --- /dev/null +++ b/src/main/target/AETH743Basic/target.h @@ -0,0 +1,181 @@ +/* + * This file is part of INAV. + * + * INAV is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with INAV. If not, see . + */ + + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "H743" + +#define USBD_PRODUCT_STRING "AETH743Basic" + +#define USE_TARGET_CONFIG + +#define LED0 PE3 +#define LED1 PE4 + +#define BEEPER PA15 +#define BEEPER_INVERTED +#define BEEPER_PWM_FREQUENCY 2000 + +// *************** IMU generic *********************** +#define USE_DUAL_GYRO +#define USE_TARGET_IMU_HARDWARE_DESCRIPTORS +#define USE_SPI +#define USE_IMU_ICM42605 + +// *************** SPI1 IMU0 ICM42688 **************** +#define USE_SPI_DEVICE_1 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PD7 + +#define IMU_ICM42688_0_ALIGN CW0_DEG_FLIP +#define ICM42688_0_SPI_BUS BUS_SPI1 +#define ICM42688_0_CS_PIN PC15 + +// *************** SPI4 IMU1 ICM42688 ************** +#define USE_SPI_DEVICE_4 +#define SPI4_SCK_PIN PE12 +#define SPI4_MISO_PIN PE13 +#define SPI4_MOSI_PIN PE14 + +#define IMU_ICM42688_1_ALIGN CW90_DEG_FLIP +#define ICM42688_1_SPI_BUS BUS_SPI4 +#define ICM42688_1_CS_PIN PC13 + +// *************** SPI2 OSD *********************** +#define USE_SPI_DEVICE_2 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 + +#define USE_MAX7456 +#define MAX7456_SPI_BUS BUS_SPI2 +#define MAX7456_CS_PIN PB12 + +// *************** I2C /Baro/Mag ********************* +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C1_SCL PB6 +#define I2C1_SDA PB7 + +#define USE_I2C_DEVICE_2 +#define I2C2_SCL PB10 +#define I2C2_SDA PB11 + +#define USE_BARO +#define BARO_I2C_BUS BUS_I2C2 +#define USE_BARO_SPL06 + +#define USE_MAG +#define MAG_I2C_BUS BUS_I2C1 +#define USE_MAG_ALL + +#define TEMPERATURE_I2C_BUS BUS_I2C2 +#define PITOT_I2C_BUS BUS_I2C2 + +#define USE_RANGEFINDER +#define RANGEFINDER_I2C_BUS BUS_I2C1 + +// *************** UART ***************************** +#define USE_VCP + +#define USE_UART1 +#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PA10 + +#define USE_UART2 +#define UART2_TX_PIN PD5 +#define UART2_RX_PIN PD6 + +#define USE_UART3 +#define UART3_TX_PIN PD8 +#define UART3_RX_PIN PD9 + +#define USE_UART4 +#define UART4_TX_PIN PB9 +#define UART4_RX_PIN PB8 + +#define USE_UART6 +#define UART6_TX_PIN PC6 +#define UART6_RX_PIN PC7 + +#define USE_UART7 +#define UART7_TX_PIN PE8 +#define UART7_RX_PIN PE7 + +#define USE_UART8 +#define UART8_TX_PIN PE1 +#define UART8_RX_PIN PE0 + +#define SERIAL_PORT_COUNT 8 + +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL +#define SERIALRX_PROVIDER SERIALRX_CRSF +#define SERIALRX_UART SERIAL_PORT_USART6 + +#define GPS_UART SERIAL_PORT_USART2 + +// *************** SDIO SD BLACKBOX******************* +#define USE_SDCARD +#define USE_SDCARD_SDIO +#define SDCARD_SDIO_DEVICE SDIODEV_1 +#define SDCARD_SDIO_4BIT + +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT + +// *************** ADC ***************************** +#define USE_ADC +#define ADC_INSTANCE ADC1 + +#define ADC_CHANNEL_1_PIN PC0 //ADC123 VBAT1 +#define ADC_CHANNEL_2_PIN PC1 //ADC123 CURR1 +#define ADC_CHANNEL_3_PIN PC5 //ADC12 RSSI +#define ADC_CHANNEL_4_PIN PC4 //ADC12 AirS +#define ADC_CHANNEL_5_PIN PA4 //ADC12 VB2 +#define ADC_CHANNEL_6_PIN PA7 //ADC12 CU2 + +#define VBAT_ADC_CHANNEL ADC_CHN_1 +#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2 +#define RSSI_ADC_CHANNEL ADC_CHN_3 +#define AIRSPEED_ADC_CHANNEL ADC_CHN_4 + +// *************** PINIO *************************** +#define USE_PINIO +#define USE_PINIOBOX +#define PINIO1_PIN PD10 // 9Vsw +#define PINIO2_PIN PD11 // Camera switcher + +// *************** LEDSTRIP ************************ +#define USE_LED_STRIP +#define WS2811_PIN PA8 + +#define DEFAULT_FEATURES (FEATURE_OSD | FEATURE_TELEMETRY | FEATURE_CURRENT_METER | FEATURE_VBAT | FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX) +#define CURRENT_METER_SCALE 160 + +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + +#define TARGET_IO_PORTA (0xffff & ~(BIT(14) | BIT(13))) +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff +#define TARGET_IO_PORTE 0xffff + +#define MAX_PWM_OUTPUT_PORTS 15 +#define USE_DSHOT +#define USE_ESC_SENSOR +