#define SAVE_STATE not present; Presets.ini still used

On the Presets.ini GitHub page it says that the define SAVE_STATE has to be included in the upload to trigger Presets.ini to be looked at.

I don’t have that define, and yet I am using the presets.ini file constantly and as expected. Is the SAVE_STATE define included in any others I’ve listed below? If not, can someone explain this behavior?

#ifdef CONFIG_TOP
#include "proffieboard_v2_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 2
#define VOLUME 1750
const unsigned int maxLedsPerStrip = 144;
#define CLASH_THRESHOLD_G 4.0
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define COLOR_CHANGE_DIRECT
#define IDLE_OFF_TIME 60*2*1000
#define MOTION_TIMEOUT 60*10*1000
#define SHARED_POWER_PINS
#define DISABLE_DIAGNOSTIC_COMMANDS
#define BLADE_DETECT_PIN 17
#define SAVE_PRESET
#define NO_REPEAT_RANDOM
#define KEEP_SAVEFILES_WHEN_PROGRAMMING
#define FETT263_SAY_COLOR_LIST
#define FETT263_SAY_COLOR_LIST_CC
#define ENABLE_ALL_EDIT_OPTIONS
#define FETT263_EDIT_MODE_MENU
#define DISABLE_BASIC_PARSER_STYLES
#define FETT263_SAY_BATTERY_PERCENT
#define FETT263_MULTI_PHASE
#define FETT263_HOLD_BUTTON_OFF
#define FETT263_HOLD_BUTTON_LOCKUP
#define FETT263_TWIST_OFF
#define FETT263_TWIST_ON
#define FETT263_TWIST_ON_NO_BM
#define FETT263_STAB_ON
#define FETT263_STAB_ON_NO_BM
#define FETT263_THRUST_ON
#define FETT263_THRUST_ON_NO_BM
#endif

#define SAVE_STATE causes the presets.ini file to be written to.
If you remove that define, you wont have current stuff saved new,
but there’s nothing preventing the OS from still using what’s already been written.

You also have #define KEEP_SAVEFILES_WHEN_PROGRAMMING
which is going to have the board ignore any new uploaded changes and read from the presets.ini file instead.

It sounds like you just want to delete presets.ini/tmp from the SD.

Read this:

This saves everything :wink:

As Brian noted remove this and read that link he provided before reenabling.

Thanks @Fett263 and @NoSloppy.

The only piece of missing information I didn’t have is that “ENABLE_ALL_EDIT_OPTIONS” includes everything. I was referencing this page at the bottom. If “SAVE_STATE” was called out there, I’d have never made the thread.

Thanks again to both!

I just updated the Wiki to clarify :wink:

Appreciate that. Just a suggestion after re-reading w/ the edit…perhaps specify that SAVE_STATE is nothing more than those defines, as the collective exhaustion aspect of the equation is what’s missing to me.

In other words, it is clear that the four defines referenced are included in SAVE_STATE, but not that SAVE_STATE can be replaced by those four included in the ENABLE_ALL_EDIT_OPTIONS define. I hope that is helpful.

They’re not “identical” both are referenced right in the .ino

ENABLE_ALL_EDIT_OPTIONS is needed for Edit Mode and has all of the editable defines in place, SAVE_STATE doesn’t and also adds SAVE_PRESET which keeps last active preset, that is not needed (or desired) for Edit Mode.

ok how about now
The CONFIG_TOP section

Thanks @NoSloppy! Looks clear as day now.

@Fett263, got it loud and clear. Cheers.

1 Like

Sorry, one more question.

So, which define(s) trigger(s) the board to look at presets.ini for preset information, SAVE_STATE i.e., the underlying 4 defines; ENABLE_ALL_EDIT_OPTIONS i.e., the underlying 7 defines; or something else?

Judging on the overlapping defines between the two referenced in the .ino, it seems it is, at minimum, SAVE_VOLUME and SAVE_COLOR_CHANGE, but isn’t there more to it than that?

Thanks again.

There is currently no define that makes ProffieOS ignore presets.ini completely.

I’m asking the opposite of that. Which trigger the board to seek/use, not ignore, presets.ini?

There is also no define for that.
It always[1] does that.

[1] unless the install date doesn’t match and KEEP_SAVEFILES_WHEN_PROGRAMMING is not defined.

Perhaps an update to the GitHub re: Presets.ini pre-requisites is in order? Specifically, the below callout, located at this GitHub page.

IMPORTANT: to use presets.ini, you have to flash the saber with the #define SAVE_STATE in your config file, so the saber knows to look at the SD card for preset information.

How about now?

If I am reading it correctly, then that means it is SAVE_PRESET that triggers the Presets.ini writing/reading. I was under a different impression based on @profezzorn’s last post. However, if that’s accurate, it is clear as day.

Thanks again.