Closed classicrocker883 closed 1 year ago
So I got this working! I hope someone can review this code and give me some pointers (pun intended)
Now, the code may not be A+ 100% whatever typically should be, but it works!
File lcd/e3v2/common/encoder.cpp line ~130
#if ENABLED(ENCODER_RATE_MULTIPLIER) int* encRateA = &ui.enc_rateA; int32_t* encRateB = &ui.enc_rateB; int a = *encRateA; int32_t b = *encRateB; millis_t ms = millis(); int32_t encoderMultiplier = 1; ------------------[after lines of code]--------------- if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = a; else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = b;
File lcd/marlinui.cpp line ~70
constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #if ENABLED(ENCODER_RATE_MULTIPLIER) int MarlinUI::enc_rateA; int32_t MarlinUI::enc_rateB; #endif
File lcd/marlinui.cpp line ~200 after class MarlinUI {
class MarlinUI {
public: #if ENABLED(ENCODER_RATE_MULTIPLIER) static int enc_rateA; static int32_t enc_rateB; #endif
File src/module/settings.cpp in the SettingsDataStruct {
SettingsDataStruct {
// // Encoder Rate // #if ENABLED(ENCODER_RATE_MULTIPLIER) int enc_rateA; int32_t enc_rateB; #endif ------------------[Many lines, goes with similar code]-------------- #if ENABLED(ENCODER_RATE_MULTIPLIER) EEPROM_WRITE(ui.enc_rateA); EEPROM_WRITE(ui.enc_rateB); #endif ------------------[Many lines, goes with similar code]-------------- #if ENABLED(ENCODER_RATE_MULTIPLIER) _FIELD_TEST(enc_rateA); EEPROM_READ(ui.enc_rateA); _FIELD_TEST(enc_rateB); EEPROM_READ(ui.enc_rateB); #endif ------------------[Many lines, goes with similar code]-------------- #if ENABLED(ENCODER_RATE_MULTIPLIER) ui.enc_rateA = 550; ui.enc_rateB = 110; #endif
File dwin.cpp
void SetEncRate() { SetPIntOnClick( 0, 1000); } -----------------[Many lines]-------------- #if ENABLED(ENCODER_RATE_MULTIPLIER) EDIT_ITEM_F(ICON_ProbeMargin, "Enc Rate 1000x", onDrawPIntMenu, SetEncRate, &ui.enc_rateA); EDIT_ITEM_F(ICON_ProbeMargin, "Enc Rate 100x", onDrawPInt32Menu, SetEncRate, &ui.enc_rateB); #endif -----------------[Include in a menu function]--------------
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
So I got this working! I hope someone can review this code and give me some pointers (pun intended)
Now, the code may not be A+ 100% whatever typically should be, but it works!
File lcd/e3v2/common/encoder.cpp line ~130
File lcd/marlinui.cpp line ~70
File lcd/marlinui.cpp line ~200 after
class MarlinUI {
File src/module/settings.cpp in the
SettingsDataStruct {
File dwin.cpp