Skip to content

Commit

Permalink
do not allow zero length blades
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Aug 13, 2024
1 parent d9eb954 commit 2fdb5d1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modes/settings_menues.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct ChangeBladeLengthBlade1 : public SPEC::MenuBase {
int maxlen = prop_GetMaxBladeLength(blade());
saved_len_ = len;
if (len == -1) len = maxlen;
this->pos_ = len;
this->pos_ = len - 1;
prop_SetBladeLength(blade(), maxlen);
showlen_.Start(blade());
SPEC::MenuBase::mode_activate(onreturn);
Expand All @@ -90,13 +90,13 @@ struct ChangeBladeLengthBlade1 : public SPEC::MenuBase {
showlen_.Stop(blade());
}
void say() override {
getSL<SPEC>()->SayWhole(this->pos_);
getSL<SPEC>()->SayWhole(getLength());
}
uint16_t size() override {
return prop_GetMaxBladeLength(blade());
}
void select() override {
prop_SetBladeLength(blade(), this->pos_);
prop_SetBladeLength(blade(), getLength());
prop_SaveState();
SPEC::MenuBase::select();
}
Expand All @@ -106,7 +106,7 @@ struct ChangeBladeLengthBlade1 : public SPEC::MenuBase {
}

virtual int steps_per_revolution() { return 16; }
int getLength() { return this->pos_; }
int getLength() { return this->pos_ + 1; }

ShowColorSingleBladeTemplate<typename SPEC::ShowLengthStyle> showlen_;
int saved_len_;
Expand Down

0 comments on commit 2fdb5d1

Please sign in to comment.