From 45b242d5f78a7f19d0462f359c703ac4eb06be5c Mon Sep 17 00:00:00 2001 From: Costas Basdekis Date: Wed, 11 Nov 2020 02:13:29 +0000 Subject: [PATCH] Fix Linux GPIO logging (#20093) Co-authored-by: Scott Lahteine --- .gitignore | 3 +++ Marlin/src/HAL/LINUX/main.cpp | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 1ac1abbe1..4e4412f5e 100755 --- a/.gitignore +++ b/.gitignore @@ -183,3 +183,6 @@ cmake-build-* #Python __pycache__ + +#IOLogger logs +*_log.csv diff --git a/Marlin/src/HAL/LINUX/main.cpp b/Marlin/src/HAL/LINUX/main.cpp index 481f05903..eadc40932 100644 --- a/Marlin/src/HAL/LINUX/main.cpp +++ b/Marlin/src/HAL/LINUX/main.cpp @@ -19,22 +19,23 @@ */ #ifdef __PLAT_LINUX__ -extern void setup(); -extern void loop(); - -#include - -#include -#include +//#define GPIO_LOGGING // Full GPIO and Positional Logging #include "../../inc/MarlinConfig.h" -#include -#include #include "../shared/Delay.h" #include "hardware/IOLoggerCSV.h" #include "hardware/Heater.h" #include "hardware/LinearAxis.h" +#include +#include +#include +#include +#include + +extern void setup(); +extern void loop(); + // simple stdout / stdin implementation for fake serial port void write_serial_thread() { for (;;) { @@ -64,8 +65,6 @@ void simulation_loop() { LinearAxis z_axis(Z_ENABLE_PIN, Z_DIR_PIN, Z_STEP_PIN, Z_MIN_PIN, Z_MAX_PIN); LinearAxis extruder0(E0_ENABLE_PIN, E0_DIR_PIN, E0_STEP_PIN, P_NC, P_NC); - //#define GPIO_LOGGING // Full GPIO and Positional Logging - #ifdef GPIO_LOGGING IOLoggerCSV logger("all_gpio_log.csv"); Gpio::attachLogger(&logger); @@ -88,7 +87,7 @@ void simulation_loop() { #ifdef GPIO_LOGGING if (x_axis.position != x || y_axis.position != y || z_axis.position != z) { - uint64_t update = MAX3(x_axis.last_update, y_axis.last_update, z_axis.last_update); + uint64_t update = _MAX(x_axis.last_update, y_axis.last_update, z_axis.last_update); position_log << update << ", " << x_axis.position << ", " << y_axis.position << ", " << z_axis.position << std::endl; position_log.flush(); x = x_axis.position;