Skip to content

Commit

Permalink
Extend build info with defined flags (betaflight#13333)
Browse files Browse the repository at this point in the history
* Extend build info with defined flags

* Fix CI

* Formatting

* Update license header

* Build options (WIP)

* Review fixes

* Add MSP build info generator

* Review fixes

* Add input hash

* Fix for PascalCase

* Add comment about MSP version
  • Loading branch information
atomgomba authored Mar 21, 2024
1 parent b9b4b77 commit 9dfa09a
Show file tree
Hide file tree
Showing 6 changed files with 432 additions and 0 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions mk/source.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ COMMON_SRC = \
io/usb_msc.c \
msp/msp.c \
msp/msp_box.c \
msp/msp_build_info.c \
msp/msp_serial.c \
scheduler/scheduler.c \
sensors/adcinternal.c \
Expand Down
3 changes: 3 additions & 0 deletions src/main/msp/msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
#include "io/vtx_msp.h"

#include "msp/msp_box.h"
#include "msp/msp_build_info.h"
#include "msp/msp_protocol.h"
#include "msp/msp_protocol_v2_betaflight.h"
#include "msp/msp_protocol_v2_common.h"
Expand Down Expand Up @@ -749,6 +750,8 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
sbufWriteData(dst, buildDate, BUILD_DATE_LENGTH);
sbufWriteData(dst, buildTime, BUILD_TIME_LENGTH);
sbufWriteData(dst, shortGitRevision, GIT_SHORT_REVISION_LENGTH);
// Added in API version 1.47
sbufWriteBuildInfoFlags(dst);
break;

case MSP_ANALOG:
Expand Down
176 changes: 176 additions & 0 deletions src/main/msp/msp_build_info.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software 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.
*
* Betaflight 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 this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/

/*
* WARNING: This is an auto-generated file, please do not edit directly!
*
* Generator : `src/utils/make-build-info.py`
* Source : https://build.betaflight.com/api/options/4.5.0-zulu
* Input hash : 2b66ff01549c4d858593dbf96c6aae12
*/

#include <stdint.h>

#include "platform.h"

#include "common/streambuf.h"

#include "msp/msp_build_info.h"

void sbufWriteBuildInfoFlags(sbuf_t *dst)
{
static const uint16_t options[] = {
#ifdef USE_SERIALRX_CRSF
BUILD_OPTION_SERIALRX_CRSF,
#endif
#ifdef USE_SERIALRX_FPORT
BUILD_OPTION_SERIALRX_FPORT,
#endif
#ifdef USE_SERIALRX_GHST
BUILD_OPTION_SERIALRX_GHST,
#endif
#ifdef USE_SERIALRX_IBUS
BUILD_OPTION_SERIALRX_IBUS,
#endif
#ifdef USE_SERIALRX_JETIEXBUS
BUILD_OPTION_SERIALRX_JETIEXBUS,
#endif
#ifdef USE_RX_PPM
BUILD_OPTION_RX_PPM,
#endif
#ifdef USE_SERIALRX_SBUS
BUILD_OPTION_SERIALRX_SBUS,
#endif
#ifdef USE_SERIALRX_SPEKTRUM
BUILD_OPTION_SERIALRX_SPEKTRUM,
#endif
#ifdef USE_SERIALRX_SRXL2
BUILD_OPTION_SERIALRX_SRXL2,
#endif
#ifdef USE_SERIALRX_SUMD
BUILD_OPTION_SERIALRX_SUMD,
#endif
#ifdef USE_SERIALRX_SUMH
BUILD_OPTION_SERIALRX_SUMH,
#endif
#ifdef USE_SERIALRX_XBUS
BUILD_OPTION_SERIALRX_XBUS,
#endif
#ifdef USE_TELEMETRY_FRSKY_HUB
BUILD_OPTION_TELEMETRY_FRSKY_HUB,
#endif
#ifdef USE_TELEMETRY_HOTT
BUILD_OPTION_TELEMETRY_HOTT,
#endif
#ifdef USE_TELEMETRY_IBUS_EXTENDED
BUILD_OPTION_TELEMETRY_IBUS_EXTENDED,
#endif
#ifdef USE_TELEMETRY_LTM
BUILD_OPTION_TELEMETRY_LTM,
#endif
#ifdef USE_TELEMETRY_MAVLINK
BUILD_OPTION_TELEMETRY_MAVLINK,
#endif
#ifdef USE_TELEMETRY_SMARTPORT
BUILD_OPTION_TELEMETRY_SMARTPORT,
#endif
#ifdef USE_TELEMETRY_SRXL
BUILD_OPTION_TELEMETRY_SRXL,
#endif
#ifdef USE_ACRO_TRAINER
BUILD_OPTION_ACRO_TRAINER,
#endif
#ifdef USE_AKK_SMARTAUDIO
BUILD_OPTION_AKK_SMARTAUDIO,
#endif
#ifdef USE_BATTERY_CONTINUE
BUILD_OPTION_BATTERY_CONTINUE,
#endif
#ifdef USE_CAMERA_CONTROL
BUILD_OPTION_CAMERA_CONTROL,
#endif
#ifdef USE_DASHBOARD
BUILD_OPTION_DASHBOARD,
#endif
#ifdef USE_EMFAT_TOOLS
BUILD_OPTION_EMFAT_TOOLS,
#endif
#ifdef USE_ESCSERIAL_SIMONK
BUILD_OPTION_ESCSERIAL_SIMONK,
#endif
#ifdef USE_FRSKYOSD
BUILD_OPTION_FRSKYOSD,
#endif
#ifdef USE_GPS
BUILD_OPTION_GPS,
#endif
#ifdef USE_LED_STRIP
BUILD_OPTION_LED_STRIP,
#endif
#ifdef USE_LED_STRIP_64
BUILD_OPTION_LED_STRIP_64,
#endif
#ifdef USE_MAG
BUILD_OPTION_MAG,
#endif
#ifdef USE_OSD_SD
BUILD_OPTION_OSD_SD,
#endif
#ifdef USE_OSD_HD
BUILD_OPTION_OSD_HD,
#endif
#ifdef USE_PINIO
BUILD_OPTION_PINIO,
#endif
#ifdef USE_RACE_PRO
BUILD_OPTION_RACE_PRO,
#endif
#ifdef USE_SERVOS
BUILD_OPTION_SERVOS,
#endif
#ifdef USE_VTX
BUILD_OPTION_VTX,
#endif
#ifdef USE_BRUSHED
BUILD_OPTION_BRUSHED,
#endif
#ifdef USE_DSHOT
BUILD_OPTION_DSHOT,
#endif
#ifdef USE_MULTISHOT
BUILD_OPTION_MULTISHOT,
#endif
#ifdef USE_ONESHOT
BUILD_OPTION_ONESHOT,
#endif
#ifdef USE_PROSHOT
BUILD_OPTION_PROSHOT,
#endif
#ifdef USE_PWM_OUTPUT
BUILD_OPTION_PWM_OUTPUT,
#endif
};

for (unsigned i = 0; i < ARRAYLEN(options); i++)
{
sbufWriteU16(dst, options[i]);
}
}
82 changes: 82 additions & 0 deletions src/main/msp/msp_build_info.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software 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.
*
* Betaflight 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 this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/

/*
* WARNING: This is an auto-generated file, please do not edit directly!
*
* Generator : `src/utils/make-build-info.py`
* Source : https://build.betaflight.com/api/options/4.5.0-zulu
* Input hash : 2b66ff01549c4d858593dbf96c6aae12
*/

#pragma once

#include "common/streambuf.h"

// Radio Protocols
#define BUILD_OPTION_SERIALRX_CRSF 4097
#define BUILD_OPTION_SERIALRX_FPORT 4098
#define BUILD_OPTION_SERIALRX_GHST 4099
#define BUILD_OPTION_SERIALRX_IBUS 4100
#define BUILD_OPTION_SERIALRX_JETIEXBUS 4101
#define BUILD_OPTION_RX_PPM 4102
#define BUILD_OPTION_SERIALRX_SBUS 4103
#define BUILD_OPTION_SERIALRX_SPEKTRUM 4104
#define BUILD_OPTION_SERIALRX_SRXL2 4105
#define BUILD_OPTION_SERIALRX_SUMD 4106
#define BUILD_OPTION_SERIALRX_SUMH 4107
#define BUILD_OPTION_SERIALRX_XBUS 4108
// Telemetry Protocols
#define BUILD_OPTION_TELEMETRY_FRSKY_HUB 12301
#define BUILD_OPTION_TELEMETRY_HOTT 12302
#define BUILD_OPTION_TELEMETRY_IBUS_EXTENDED 12303
#define BUILD_OPTION_TELEMETRY_LTM 12304
#define BUILD_OPTION_TELEMETRY_MAVLINK 12305
#define BUILD_OPTION_TELEMETRY_SMARTPORT 12306
#define BUILD_OPTION_TELEMETRY_SRXL 12307
// General Options
#define BUILD_OPTION_ACRO_TRAINER 16404
#define BUILD_OPTION_AKK_SMARTAUDIO 16405
#define BUILD_OPTION_BATTERY_CONTINUE 16406
#define BUILD_OPTION_CAMERA_CONTROL 16407
#define BUILD_OPTION_DASHBOARD 16408
#define BUILD_OPTION_EMFAT_TOOLS 16409
#define BUILD_OPTION_ESCSERIAL_SIMONK 16410
#define BUILD_OPTION_FRSKYOSD 16411
#define BUILD_OPTION_GPS 16412
#define BUILD_OPTION_LED_STRIP 16413
#define BUILD_OPTION_LED_STRIP_64 16414
#define BUILD_OPTION_MAG 16415
#define BUILD_OPTION_OSD_SD 16416
#define BUILD_OPTION_OSD_HD 16417
#define BUILD_OPTION_PINIO 16418
#define BUILD_OPTION_RACE_PRO 16419
#define BUILD_OPTION_SERVOS 16420
#define BUILD_OPTION_VTX 16421
// Motor Protocols
#define BUILD_OPTION_BRUSHED 8230
#define BUILD_OPTION_DSHOT 8231
#define BUILD_OPTION_MULTISHOT 8232
#define BUILD_OPTION_ONESHOT 8233
#define BUILD_OPTION_PROSHOT 8234
#define BUILD_OPTION_PWM_OUTPUT 8235

void sbufWriteBuildInfoFlags(sbuf_t *dst);
Loading

0 comments on commit 9dfa09a

Please sign in to comment.