Skip to content

Commit

Permalink
Merge pull request #1314 from ColPaulR/$GS-and-$13
Browse files Browse the repository at this point in the history
$gs grbl/show implementation for CNCjs initiliazation without soft reset and $13 implementation
  • Loading branch information
bdring authored Dec 31, 2024
2 parents 64bb780 + f2432ea commit c16a8ac
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions FluidNC/src/ProcessSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
// WU Readable and writable as user and admin
// WA Readable as user and admin, writable as admin

static Error switchInchMM(const char* value, AuthenticationLevel auth_level, Channel& out);

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

static Error report_init_message_cmd(const char* value, AuthenticationLevel auth_level, Channel& out);

// If authentication is disabled, auth_level will be LEVEL_ADMIN
static bool auth_failed(Word* w, const char* value, AuthenticationLevel auth_level) {
permissions_t permissions = w->getPermissions();
Expand Down Expand Up @@ -193,9 +197,13 @@ static void show_settings(Channel& out, type_t type) {
show_setting(s->getGrblName(), s->getCompatibleValue(), NULL, out);
}
}
// Print Report/Inches
switchInchMM(NULL, AuthenticationLevel::LEVEL_ADMIN, out);

// need this per issue #1036
fakeMaxSpindleSpeed(NULL, AuthenticationLevel::LEVEL_ADMIN, out);
}

static Error report_normal_settings(const char* value, AuthenticationLevel auth_level, Channel& out) {
show_settings(out, GRBL); // GRBL non-axis settings
return Error::Ok;
Expand Down Expand Up @@ -709,6 +717,22 @@ static Error dump_config(const char* value, AuthenticationLevel auth_level, Chan
return Error::Ok;
}

static Error report_init_message_cmd(const char* value, AuthenticationLevel auth_level, Channel& out) {
report_init_message(out);

return Error::Ok;
}

static Error switchInchMM(const char* value, AuthenticationLevel auth_level, Channel& out) {
if (!value) {
log_stream(out, "$13=" << (config->_reportInches ? "1" : "0"));
} else {
config->_reportInches = ((value[0]=='1') ? true : false);
}

return Error::Ok;
}

static Error fakeMaxSpindleSpeed(const char* value, AuthenticationLevel auth_level, Channel& out) {
if (!value) {
log_stream(out, "$30=" << spindle->maxSpeed());
Expand Down Expand Up @@ -841,9 +865,12 @@ void make_user_commands() {

new UserCommand("RI", "Report/Interval", setReportInterval, anyState);

new UserCommand("13", "Report/Inches", switchInchMM, notIdleOrAlarm);
new UserCommand("30", "FakeMaxSpindleSpeed", fakeMaxSpindleSpeed, notIdleOrAlarm);
new UserCommand("32", "FakeLaserMode", fakeLaserMode, notIdleOrAlarm);

new UserCommand("GS", "GRBL/Show", report_init_message_cmd, notIdleOrAlarm);

new AsyncUserCommand("J", "Jog", doJog, notIdleOrJog);
new AsyncUserCommand("G", "GCode/Modes", report_gcode, anyState);
};
Expand Down

0 comments on commit c16a8ac

Please sign in to comment.