#define SAVE_PRESET not working? ...I think?

I’m using a Proffie V2.2 and ProffieOS7. I used the Fett263 Config Helper. My understanding is that the SAVE_PRESET define should make it so that the saber ignites with the last used preset after the saber has been turned off? After I remove the kill key, the saber always reverts back to the first preset in the config no matter what preset was being used before the kill key was inserted.
Also, do I need the SAVE_STATE define? That one didn’t show up after using the config helper. The top of my config is below in case this helps.

// ProffieOS7 Config File
#ifdef CONFIG_TOP
#include "proffieboard_v2_config.h"
#define NUM_BLADES 1
#define NUM_BUTTONS 1
const unsigned int maxLedsPerStrip = 124;
#define EXTRA_COLOR_BUFFER_SPACE 60
#define VOLUME 850
#define CLASH_THRESHOLD_G 5
#define ENABLE_AUDIO
#define ENABLE_MOTION
#define ENABLE_WS2811
#define ENABLE_SD
#define MOTION_TIMEOUT 60 * 15 * 1000
#define IDLE_OFF_TIME 60 * 15 * 1000
#define DISABLE_BASIC_PARSER_STYLES
#define ENABLE_ALL_EDIT_OPTIONS
#define SAVE_PRESET
#define NO_REPEAT_RANDOM
#define COLOR_CHANGE_DIRECT
#define FETT263_EDIT_MODE_MENU
#define FETT263_SAY_COLOR_LIST
#define FETT263_SAY_COLOR_LIST_CC
#define FETT263_SAY_BATTERY_PERCENT
#define FETT263_BATTLE_MODE_START_ON
#define FETT263_LOCKUP_DELAY 200
#define FETT263_BM_CLASH_DETECT 7
#define FETT263_SWING_ON_SPEED 350
#define FETT263_SWING_ON
#define FETT263_TWIST_ON_PREON
//#define FETT263_TWIST_ON_NO_BM
#define FETT263_TWIST_OFF
#endif

#ifdef CONFIG_PROP
#include "../props/saber_fett263_buttons.h"
#endif


#ifdef CONFIG_PRESETS

#ifdef CONFIG_PRESETS

This is correct.

SAVE_STATE is just an alias for a few other defines, SAVE_PRESET is one of those.

Not sure why this wouldn’t work, hopefully @Fett263 can try these defines and see if the same problem occurs or not.

SAVE_PRESET should work as expected in my prop, it’s primarily controlled in prop_base.h. The only addition my prop has is handling in the Select Preset dial menu, but that looks correct to me as well. I don’t actually use that define but I don’t see anything that would cause it not to work in my prop.

@bbbrayyy first question, are you sure you’re successfully uploading this config? Maybe introduce an error, in your first preset remove the “S” from “StylePtr<…” and try uploading. If you don’t get an error then you’re uploading a different config than you’re editing. If it does give an error, fix the “S” and then make sure it successfully uploads.

If it does successfully upload, let me know exactly what you’re doing; are you using the controls for Next/Previous preset or are you using the Select Preset menu where you can use the saber as a dial to run through all of your presets? If you’re using the menu, are you clicking the button to select the preset or are you exiting without selecting. The Select Preset has a second step of selecting the preset, that should be where the preset gets saved. Once we can narrow down which mechanism is being used we can see if there’s something up in prop_base or my prop.

I’m sure the config is uploading properly. I’ve uploaded it several times with different tweaks to multiple settings. I did have an error uploading second before last as I had the define for a swing on with no battle mode and start with battle mode active and it told me I couldn’t do that. You’ll see that I just remarked-out the swing on define. The start with battle mode, an adjustment to the volume and LED count were changes that I made to this last iteration. Those changes are present when operating the saber. In fact the reason I changed the LED count is because if I had it at 144, then used the edit settings menu to dial it down to 124, it would go back to 144 after being turned off. I’m making this for a friend and the current blade has 124 but I wanted it setup to the max in case he ever bought a different blade.

I’ve being scrolling through the presents one at a time forward or backwards. I don’t normally use the menu where you rotate through the choices. This is a single button so I long press then release with the saber horizontal to cycle through the different presets.

This is the 6th saber I’ve installed but the first where I’ve installed using OS7 and your config helper.

Thank you for your help.

For info, that is not how to change the led count.

should be 144, unless you have a strip with more leds per meter.

The exact led number should be changed in the BladeConfig blades[] = { section

 { 0, WS281XBladePtr<124, bladePin, Color8::GRB, PowerPINS<bladePowerPin2, bladePowerPin3> >(),
CONFIGARRAY(presets) },

};

1 Like

This should ALWAYS be 144, unless you have a saber with more than 144 pixels in series. You’d change the actual blade length in the BladeConfig or leave as 144 in Blade Config and edit the Blade length via Edit Mode

That sounds like there’s an issue with the .ini files on the SD, which would make the edits and save preset not work. Maybe try reformatting the SD and only restore the fonts, don’t copy the .tmp and .ini files in the root of the SD, those may be corrupted and causing your issue.

If you have Mass Storage enabled, make sure you’re always ejecting the SD anytime you are connected to the computer to avoid corrupting the SD or files on it.

I’ll be able to try this in a couple hours. I’ll report back what happens. Here’s a question. This SD card is a 64g that I used Rufus to format to Fat32. It’s a class 10, SanDisk extreme. Would any of this effect any of this?

Maybe run ‘sdtest’ on the SD card to check. I don’t usually use that large of an SD, not sure if that would be the issue. @profezzorn are there issues with such a large SD?

The fact that you say you’re editing the blade length and it’s not saving leads me to the .ini files. Edits in Edit Mode and Save Preset use the same mechanism via .ini files on the SD so if both aren’t working it would point to an issue with the .ini files or the ability for the board to read those files on the SD.

That could be fine. Most of the pros here recommend:

I’m seeing some config.ini files within font folders. Those can stay, yes?

Yes, those are for the font leave those only. It would only be files in the root; global.tmp, global.ini, gestures.tmp, gestures.ini, presets.tmp, presets.ini etc. you want to remove those in case they are corrupted, then reformat.

no, there is not.

1 Like

I tried this just now. It appears the app automatically sets the formatting based on the size and type of SD card? It formatted to exFAT. I used Rufus because you can force a FAT32. I’m going to go back to Rufus and FAT32 and try Fett’s suggestions next.

Cool.

From the Proffie POD:

“For formatting the SD card I recommend using the SD card association formatter. Other ways to format may be fine, but some use partitions or file systems that ProffieOS doesn’t support. If you use something else to format and it doesn’t work, please try the SD card association one.”

But whatever works, works :slight_smile:

The caveat here is that if it’s over 32G, it won’t format as FAT32 which is the only format Proffie recognizes. That’s why I used Rufus. I dug around a little on the SD Card website and couldn’t find anything that allowed me to force a FAT32 format on a 64G SD card. I had gone to purchase a fast SD card for this project and since they were out of the fast smaller ones, the guy at Office Depot sold me the 64G at the same price as a 32G. So that’s why I got stuck with it in the first place.

1 Like

It works!
Fett, it must have been a bad .ini file. I nuked the SD card and reformatted it with Rufus to FAT32. Then I only put the font folders, a copy of the config for this saber, and the PDF docs from your config helper that show how to use the buttons. I also fixed the LED number at the top of the config. Now whatever preset was used before, that’s the one that fires up after the kill key is removed.

Thank you everyone for all the input. It’s an awesome community when 2 of the guys that are literally part of the foundation of modern open source saber building are available to help out.

1 Like

You’re welcome, glad that sorted it.

As an FYI: FAT32 can handle file systems up to 2Tb.
However,some formatting tools don’t like it, if so use another tool, or just make a smaller partition. You likely won’t need more than a few Gb anyways.

Ok, here’s the funny part. This is the first saber I’ve built in a few years so OS7 and Edit Mode are new to me. Now that the save preset function is working, is there an edit mode setting that resets all the presets that were on the board originally back to their original state? I built this for a friend. It’s one button and he gets a little excited when trying to manipulate the menus. Somehow he scrambled up several fonts/blade styles. I’m hoping he can reset them without having to re-flash the board?

No need to reflash, just delete the ini & tmp file that are NOT in the font/common folders from the SD-cards.

These:
“curstate.ini”,
“curstate.tmp”,
“presets.ini”,
“presets.tmp”,
“global.ini”,
“global.tmp”,
“arraysve.ini”,
“arraysve.tmp”