From b65efe9b0379e222371e83263dc0efc1eb99f2a7 Mon Sep 17 00:00:00 2001 From: Phil Hord Date: Sun, 27 Oct 2013 16:00:04 -0400 Subject: [PATCH] Move argc/argv processing deeper into simulator. Less magic == more better. --- mendel.c | 5 +---- simulator/simulator.c | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mendel.c b/mendel.c index 4fc1d41..019a38e 100644 --- a/mendel.c +++ b/mendel.c @@ -232,12 +232,9 @@ void init(void) { /// /// just run init(), then run an endless loop where we pass characters from the serial RX buffer to gcode_parse_char() and check the clocks #ifdef SIMULATOR -int g_argc; -char** g_argv; int main (int argc, char** argv) { - g_argc = argc; - g_argv = argv; + sim_start(argc, argv); #else int main (void) { diff --git a/simulator/simulator.c b/simulator/simulator.c index 971b172..b284902 100644 --- a/simulator/simulator.c +++ b/simulator/simulator.c @@ -27,6 +27,15 @@ volatile uint8_t DIO3_WPORT, DIO4_WPORT; +int g_argc; +char** g_argv; +void sim_start(int argc, char** argv) { + // TODO: Parse args here and open the serial port instead of saving them + // for serial_init. + // Save these for the serial_init code + g_argc = argc; + g_argv = argv; +} /* -- debugging ------------------------------------------------------------ */