Skip to content

Instantly share code, notes, and snippets.

@DurvalMenezes
Last active June 15, 2023 09:14
Show Gist options
  • Save DurvalMenezes/6d2a6ba22391d19ef450673bdce1d0f7 to your computer and use it in GitHub Desktop.
Save DurvalMenezes/6d2a6ba22391d19ef450673bdce1d0f7 to your computer and use it in GitHub Desktop.
Quick kludge to find out how many EEPROM bytes are in use (at maximum) on Anduril multi-channel branch rev. 721
//For explanation and rationale, see https://budgetlightforum.com/t/anduril-2-feature-change-suggestions/218045/234
typedef unsigned char uint8_t;
typedef signed char int8_t;
#define NUM_RAMPS 3
#define NUM_CHANNEL_MODES 8
typedef struct Config {
///// ramp vars
uint8_t ramp_style;
uint8_t ramp_2c_style;
uint8_t ramp_floors[NUM_RAMPS];
uint8_t ramp_ceils [NUM_RAMPS];
uint8_t ramp_stepss[NUM_RAMPS];
uint8_t simple_ui_active;
uint8_t dont_ramp_after_moon;
uint8_t manual_memory;
uint8_t manual_memory_timer;
uint8_t channel_mode;
uint8_t channel_modes_enabled;
uint8_t manual_memory_channel_mode;
uint8_t blink_channel;
uint8_t channel_mode_args[NUM_CHANNEL_MODES];
uint8_t manual_memory_channel_args[NUM_CHANNEL_MODES];
uint8_t tint_ramp_style;
///// strobe / blinky mode settings
uint8_t strobe_type;
uint8_t strobe_delays[2];
uint8_t bike_flasher_brightness;
uint8_t beacon_seconds;
///// voltage and temperature
uint8_t voltage_correction;
uint8_t therm_ceil;
int8_t therm_cal_offset;
///// aux LEDs
uint8_t indicator_led_mode;
uint8_t rgb_led_off_mode;
uint8_t rgb_led_lockout_mode;
uint8_t post_off_voltage;
///// misc other mode settings
uint8_t autolock_time;
uint8_t tactical_levels[3];
///// hardware config / globals menu
uint8_t jump_start_level;
} Config;
// auto-detect how many eeprom bytes
#define EEPROM_BYTES sizeof(Config)
#include <stdio.h>
int main(){
printf("EEPROM_BYTES=%d\n", EEPROM_BYTES);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment