Simulator: be more clear about files opened.
Before, a seemingly valid command like ... ./sim -o sim-log.log -t 0 testcases/triangle-odd.gcode ... would not act as expected (treat both files as G-code source) and not give meaningful hints on what's going on either. It just reported 'Could not stat file'. No hint that it tries to open the intended log file as G-code source. Now the message reporting opening of a G-code file names it as 'G-code source' and opening of the recorder file gets reported, too. Which should give a good idea about what's going on.
This commit is contained in:
parent
448a040f9a
commit
7441f6b6ba
|
|
@ -30,8 +30,9 @@ static void recorder_close(void) {
|
|||
void recorder_init(const char* filename) {
|
||||
sim_assert( ! file, "Recorder already initialized");
|
||||
|
||||
sim_info("Opening recorder file %s.", filename);
|
||||
file = fopen(filename, "w");
|
||||
sim_assert(file, "record_init: failed to create file");
|
||||
sim_assert(file, "record_init: failed to create recorder file.");
|
||||
|
||||
time_t t = time(NULL);
|
||||
fprintf(file, "# Teacup_Firmware simulator v1.0\n");
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ static void open_file() {
|
|||
// No more files
|
||||
if (i > g_argc) return;
|
||||
|
||||
sim_info("opening %s", filename);
|
||||
sim_assert(!stat(filename, &st), "Could not stat file.");
|
||||
sim_info("Opening G-code source %s.", filename);
|
||||
sim_assert(!stat(filename, &st), "Could not stat G-code source.");
|
||||
|
||||
if (!st.st_rdev) {
|
||||
// Normal file
|
||||
gcode_fd = open(filename, O_RDONLY );
|
||||
sim_assert(gcode_fd, "Could not open file.");
|
||||
sim_assert(gcode_fd, "Could not open G-code file.");
|
||||
} else {
|
||||
// Some kind of device (treat as TTY)
|
||||
open_tty(filename);
|
||||
|
|
|
|||
Loading…
Reference in New Issue