Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dollar 30 #1054

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion FluidNC/src/ProcessSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
// WU Readable and writable as user and admin
// WA Readable as user and admin, writable as admin

static Error fakeMaxSpindleSpeed(const char* value, WebUI::AuthenticationLevel auth_level, Channel& out);

// If authentication is disabled, auth_level will be LEVEL_ADMIN
static bool auth_failed(Word* w, const char* value, WebUI::AuthenticationLevel auth_level) {
permissions_t permissions = w->getPermissions();
Expand Down Expand Up @@ -193,6 +195,8 @@ static void show_settings(Channel& out, type_t type) {
show_setting(s->getGrblName(), s->getCompatibleValue(), NULL, out);
}
}
// need this per issue #1036
fakeMaxSpindleSpeed(NULL, WebUI::AuthenticationLevel::LEVEL_ADMIN, out);
}
static Error report_normal_settings(const char* value, WebUI::AuthenticationLevel auth_level, Channel& out) {
show_settings(out, GRBL); // GRBL non-axis settings
Expand Down Expand Up @@ -687,7 +691,7 @@ static Error dump_config(const char* value, WebUI::AuthenticationLevel auth_leve

static Error fakeMaxSpindleSpeed(const char* value, WebUI::AuthenticationLevel auth_level, Channel& out) {
if (!value) {
log_to(out, "$30=", spindle->maxSpeed())
log_to(out, "$30=", spindle->maxSpeed());
}
return Error::Ok;
}
Expand Down
8 changes: 8 additions & 0 deletions FluidNC/src/Spindles/Spindle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ namespace Spindles {
_speeds.push_back({ max, 100.0f });
}

uint32_t Spindle::maxSpeed() {
if (_speeds.size() == 0) {
return 0;
} else {
return _speeds[_speeds.size() - 1].speed;
}
}

uint32_t IRAM_ATTR Spindle::mapSpeed(SpindleSpeed speed) {
if (_speeds.size() == 0) {
return 0;
Expand Down
2 changes: 1 addition & 1 deletion FluidNC/src/Spindles/Spindle.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Spindles {

bool _defaultedSpeeds;
uint32_t offSpeed() { return _speeds[0].offset; }
uint32_t maxSpeed() { return _speeds[_speeds.size() - 1].speed; }
uint32_t maxSpeed();
uint32_t mapSpeed(SpindleSpeed speed);
void setupSpeeds(uint32_t max_dev_speed);
void shelfSpeeds(SpindleSpeed min, SpindleSpeed max);
Expand Down