Phase 3: STM32 Removal: Shared RX/TX parts (#3016)
[ExpressLRS.git] / src / lib / OPTIONS / options.h
blob4c8742f08a80af519986ce592634b3897575f074
1 #pragma once
3 #include "targets.h"
5 extern const unsigned char target_name[];
6 extern const uint8_t target_name_size;
7 extern const char commit[];
8 extern const char version[];
10 extern const char *wifi_hostname;
11 extern const char *wifi_ap_ssid;
12 extern const char *wifi_ap_password;
13 extern const char *wifi_ap_address;
15 enum BuzzerMode {
16 buzzerQuiet,
17 buzzerOne,
18 buzzerTune
21 typedef struct _options {
22 uint8_t _magic_[8]; // this is the magic constant so the configurator can find this options block
23 uint16_t _version_; // the version of this structure
24 uint8_t domain; // depends on radio chip
25 uint8_t hasUID;
26 uint8_t uid[6]; // MY_UID derived from MY_BINDING_PHRASE
27 uint32_t flash_discriminator; // Discriminator value used to determine if the device has been reflashed and therefore
28 // the SPIFSS settings are obsolete and the flashed settings should be used in preference
29 uint32_t fan_min_runtime;
30 int32_t wifi_auto_on_interval;
31 char home_wifi_ssid[33];
32 char home_wifi_password[65];
33 #if defined(TARGET_RX)
34 uint32_t uart_baud;
35 bool _unused1:1; // invert_tx
36 bool lock_on_first_connection:1;
37 bool _unused2:1; // r9mm_mini_sbus
38 bool is_airport:1;
39 #endif
40 #if defined(TARGET_TX) || defined(UNIT_TEST)
41 uint32_t tlm_report_interval;
42 bool _unused1:1;
43 bool unlock_higher_power:1;
44 bool is_airport:1;
45 uint32_t uart_baud; // only use for airport
46 #endif
47 } __attribute__((packed)) firmware_options_t;
49 // Layout is PRODUCTNAME DEVICENAME OPTIONS HARDWARE
50 constexpr size_t ELRSOPTS_PRODUCTNAME_SIZE = 128;
51 constexpr size_t ELRSOPTS_DEVICENAME_SIZE = 16;
52 constexpr size_t ELRSOPTS_OPTIONS_SIZE = 512;
53 constexpr size_t ELRSOPTS_HARDWARE_SIZE = 2048;
55 extern firmware_options_t firmwareOptions;
56 extern bool options_init();
58 #if defined(UNIT_TEST)
59 extern char *product_name;
60 extern char *device_name;
61 #else
62 extern char product_name[];
63 extern char device_name[];
64 extern uint32_t logo_image;
65 extern String& getOptions();
66 extern String& getHardware();
67 extern void saveOptions();
69 #include "EspFlashStream.h"
70 bool options_HasStringInFlash(EspFlashStream &strmFlash);
71 void options_SetTrueDefaults();
72 #endif