1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-23 22:52:58 +02:00

Cleaner code for setup() and loop()

This commit is contained in:
Mitch Bradley
2021-12-21 14:25:34 -10:00
parent ebf5994ae2
commit 6e4e189dfe
2 changed files with 9 additions and 9 deletions

View File

@@ -134,23 +134,23 @@ void WEAK_FUNC display_init() {}
void WEAK_FUNC user_m30() {}
void WEAK_FUNC user_tool_change(uint8_t new_tool) {}
#ifdef NATIVE
// setup() and loop() in the Arduino .ino implements this control flow:
# ifdef EMIT_YAML
# include "System.h"
# endif
int main(int arc, char** argv) {
grbl_init(); // setup()
void setup() {
grbl_init();
}
void loop() {
# ifdef EMIT_YAML
char line[10];
strcpy(line, "$cd");
system_execute_line(line, uint8_t(CLIENT_SERIAL), WebUI::AuthenticationLevel::LEVEL_ADMIN);
Uart0.flush();
exit(0);
# else
while (1) { // loop()
run_once();
}
run_once();
# endif
}
#endif

View File

@@ -97,7 +97,7 @@ namespace Motors {
bool set_homing_mode(bool is_homing) override;
void set_disable(bool disable) override;
const char* name() override { return _driver_part_number == 2008 ? "tmc_2008" : "tmc_2009"; }
const char* name() override { return _driver_part_number == 2208 ? "tmc_2208" : "tmc_2209"; }
uint8_t addr;