snowsh
Well-known member
I have this section of code, please don't ask for the full codebase, its enormous.
this->config.enableFills is declared as a bool.
When I don't have an SD card present, here is my debug:
now when I have an SD card present:
I have tried everything. Even declaring the value in a different location in case it was some weird memory issue:
This bool is only referenced 3 times in the codebase outside of the code above, it only reads the var:
the only place this value is set is in the button read code above, and at the start of the program in setup() where the SD card is read to populate values. You can see in the debug that the values are f$%^£d the moment the button routine is called.....
This has been doing my head in now for too long. ChatGPT was typically a waste of time....
Anyone have any insights?
C++:
if (checkButtonPress(BUTTON_DRUMMER_FILLS_ENABLE)) // this works fine
{
Serial.println(F("Button press detected: BUTTON_DRUMMER_FILLS_ENABLE"));
// Debug before toggling the fill enable state
Serial.print(F("Current fill enable state: "));
Serial.println(this->config.enableFills ? "on" : "off");
Serial.println(this->config.enableFills);
// some weird fucked up shit going on here...
// Toggle the fill enable state - this->config.enableFills is a bool!
//this->config.enableFills = !this->config.enableFills; // toggles betwen 4 and 5?????????
if (this->config.enableFills > 0) this->config.enableFills = false;
else if (this->config.enableFills == 0) this->config.enableFills = true;
// Debug after toggling the fill enable state
Serial.print(F("New fill enable state: "));
Serial.println(this->config.enableFills ? "on" : "off");
Serial.println(this->config.enableFills);
// Update button lights
setButtonLights(); // this works fine
}
this->config.enableFills is declared as a bool.
When I don't have an SD card present, here is my debug:
Code:
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: on
1
New fill enable state: off
0
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: off
0
New fill enable state: on
1
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: on
1
New fill enable state: off
0
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: off
0
New fill enable state: on
1
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: on
1
New fill enable state: off
0
now when I have an SD card present:
Code:
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: on
4
New fill enable state: on
5
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: on
5
New fill enable state: on
4
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: on
4
New fill enable state: on
5
Button press detected: BUTTON_DRUMMER_FILLS_ENABLE
Current fill enable state: on
5
New fill enable state: on
4
I have tried everything. Even declaring the value in a different location in case it was some weird memory issue:
C++:
struct Config{
etc.......
uint8_t activeRuleId; // to track the current fill rule being played
bool corrupt = false; // this was not working. 4/5 id SD present....to enable / disable the use of fills.
bool enableFills = false; // still not right..... to enable / disable the use of fills.
byte unused[43];//41];
};
This bool is only referenced 3 times in the codebase outside of the code above, it only reads the var:
C++:
if (this->config.enableFills)
the only place this value is set is in the button read code above, and at the start of the program in setup() where the SD card is read to populate values. You can see in the debug that the values are f$%^£d the moment the button routine is called.....
This has been doing my head in now for too long. ChatGPT was typically a waste of time....
Anyone have any insights?