| 1222 | } |
| 1223 | |
| 1224 | Error execute_line(const char* line, Channel& channel, AuthenticationLevel auth_level) { |
| 1225 | // Empty or comment line. For syncing purposes. |
| 1226 | if (line[0] == 0) { |
| 1227 | return Error::Ok; |
| 1228 | } |
| 1229 | // Skip leading whitespace |
| 1230 | while (isspace(*line)) { |
| 1231 | ++line; |
| 1232 | } |
| 1233 | // User '$' or WebUI '[ESPxxx]' command |
| 1234 | if (line[0] == '$' || line[0] == '[') { |
| 1235 | if (gc_state.skip_blocks) { |
| 1236 | return Error::Ok; |
| 1237 | } |
| 1238 | |
| 1239 | return settings_execute_line(line, channel, auth_level); |
| 1240 | } |
| 1241 | // Everything else is gcode. Block if in alarm or jog mode. |
| 1242 | if (state_is(State::Alarm) || state_is(State::ConfigAlarm) || state_is(State::Jog)) { |
| 1243 | return Error::SystemGcLock; |
| 1244 | } |
| 1245 | Error result = gc_execute_line(line); |
| 1246 | if (result != Error::Ok && result != Error::Reset) { |
| 1247 | log_error_to(channel, "Bad GCode: " << line); |
| 1248 | if (Job::active()) { |
| 1249 | send_alarm(ExecAlarm::GCodeError); |
| 1250 | } |
| 1251 | } |
| 1252 | return result; |
| 1253 | } |
no test coverage detected