Use settings desc by indexing instead of direct pointer
This commit is contained in:
@@ -110,6 +110,6 @@ enum class SettingsItemIndex : uint8_t {
|
||||
|
||||
constexpr uint8_t settings_item_index(const SettingsItemIndex i) { return static_cast<uint8_t>(i); }
|
||||
// Use a constexpr function for type-checking.
|
||||
#define SETTINGS_DESC(i) (SettingsDescriptions[settings_item_index(i)])
|
||||
#define SETTINGS_DESC(i) (settings_item_index(i) + 1)
|
||||
|
||||
#endif /* TRANSLATION_H_ */
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
|
||||
// Struct for holding the function pointers and descriptions
|
||||
typedef struct {
|
||||
const char *description;
|
||||
// The settings description index, please use the `SETTINGS_DESC` macro with
|
||||
// the `SettingsItemIndex` enum. Use 0 for no description.
|
||||
uint8_t description;
|
||||
// return true if increment reached the maximum value
|
||||
bool (*const incrementHandler)(void);
|
||||
bool (*const draw)(void);
|
||||
|
||||
Reference in New Issue
Block a user