Skip to content

Commit

Permalink
Cleanup, hex formatting, includes
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 5, 2021
1 parent f3f82f5 commit fccfcfb
Show file tree
Hide file tree
Showing 21 changed files with 2,354 additions and 2,352 deletions.
8 changes: 5 additions & 3 deletions Marlin/src/HAL/AVR/MarlinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);

template class MarlinSerial< MarlinSerialCfg<SERIAL_PORT_2> >;
MSerialT2 customizedSerial2(MSerialT2::HasEmergencyParser);
#endif

#endif // SERIAL_PORT_2

#ifdef MMU2_SERIAL_PORT

Expand All @@ -596,7 +597,8 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);

template class MarlinSerial< MMU2SerialCfg<MMU2_SERIAL_PORT> >;
MSerialT3 mmuSerial(MSerialT3::HasEmergencyParser);
#endif

#endif // MMU2_SERIAL_PORT

#ifdef LCD_SERIAL_PORT

Expand All @@ -622,7 +624,7 @@ MSerialT customizedSerial1(MSerialT::HasEmergencyParser);
}
#endif

#endif
#endif // LCD_SERIAL_PORT

#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/DUE/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* For ARDUINO_ARCH_SAM
* Note the code here was specifically crafted by disassembling what GCC produces
* out of it, so GCC is able to optimize it out as much as possible to the least
* amount of instructions. Be very carefull if you modify them, as "clean code"
* amount of instructions. Be very careful if you modify them, as "clean code"
* leads to less efficient compiled code!!
*/

Expand Down
1 change: 1 addition & 0 deletions Marlin/src/HAL/LPC1768/HAL_MinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
#ifdef TARGET_LPC1768

#include "../../inc/MarlinConfig.h"
#include "HAL.h"

#if ENABLED(POSTMORTEM_DEBUGGING)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/LPC1768/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ extern MSerialT MSerial1;
extern MSerialT MSerial2;
extern MSerialT MSerial3;

// Consequently, we can't use a RuntimeSerial either. The workaround would be to use a RuntimeSerial<ForwardSerial<MarlinSerial>> type here
// Right now, let's ignore this until it's actually required.
// Consequently, we can't use a RuntimeSerial either. The workaround would be to use
// a RuntimeSerial<ForwardSerial<MarlinSerial>> type here. Ignore for now until it's actually required.
#if ENABLED(SERIAL_RUNTIME_HOOK)
#error "SERIAL_RUNTIME_HOOK is not yet supported for LPC176x."
#endif
3 changes: 0 additions & 3 deletions Marlin/src/HAL/STM32/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@
*/
#pragma once

#include <stdint.h>
#include "../../inc/MarlinConfig.h"

// ------------------------
// Defines
// ------------------------

#define FORCE_INLINE __attribute__((always_inline)) inline

// STM32 timers may be 16 or 32 bit. Limiting HAL_TIMER_TYPE_MAX to 16 bits
// avoids issues with STM32F0 MCUs, which seem to pause timers if UINT32_MAX
// is written to the register. STM32F4 timers do not manifest this issue,
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/HAL/STM32F1/timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
* HAL for stm32duino.com based on Libmaple and compatible (STM32F1)
*/

#include <stdint.h>
#include "../../inc/MarlinConfig.h"
#include "HAL.h"

#include <libmaple/timer.h>
#include "../../core/boards.h"

// ------------------------
// Defines
Expand All @@ -37,7 +38,6 @@
* TODO: Check and confirm what timer we will use for each Temps and stepper driving.
* We should probable drive temps with PWM.
*/
#define FORCE_INLINE __attribute__((always_inline)) inline

typedef uint16_t hal_timer_t;
#define HAL_TIMER_TYPE_MAX 0xFFFF
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
*/
#ifdef __MK20DX256__

#include "../../inc/MarlinConfig.h"
#include "HAL.h"

#include <SPI.h>
#include <pins_arduino.h>
#include "spi_pins.h"
#include "../../core/macros.h"

static SPISettings spiConfig;

Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@

#if defined(__MK64FX512__) || defined(__MK66FX1M0__)

#include "../../inc/MarlinConfig.h"
#include "HAL.h"

#include <SPI.h>
#include <pins_arduino.h>
#include "spi_pins.h"
#include "../../core/macros.h"

static SPISettings spiConfig;

Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/HAL/TEENSY40_41/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@

#ifdef __IMXRT1062__

#include "../../inc/MarlinConfig.h"
#include "HAL.h"

#include "../shared/Delay.h"
#include "timers.h"

#include <Wire.h>

#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@

#ifdef __IMXRT1062__

#include "../../inc/MarlinConfig.h"
#include "HAL.h"

#include <SPI.h>
#include <pins_arduino.h>
#include "spi_pins.h"
#include "../../core/macros.h"

static SPISettings spiConfig;

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/HAL/shared/Marduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,8 @@
#define UNUSED(x) ((void)(x))
#endif

#ifndef FORCE_INLINE
#define FORCE_INLINE inline __attribute__((always_inline))
#endif

#include "progmem.h"
9 changes: 5 additions & 4 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ extern uint8_t marlin_debug_flags;
//
// Serial redirection
//
// Step 1: Find what's the first serial leaf
// Step 1: Find out what the first serial leaf is
#if BOTH(HAS_MULTI_SERIAL, SERIAL_CATCHALL)
#define _SERIAL_LEAF_1 MYSERIAL
#define _SERIAL_LEAF_1 MYSERIAL
#else
#define _SERIAL_LEAF_1 MYSERIAL1
#define _SERIAL_LEAF_1 MYSERIAL1
#endif

// Hook Meatpack if it's enabled on the first leaf
Expand All @@ -78,7 +78,8 @@ extern uint8_t marlin_debug_flags;
#define SERIAL_LEAF_1 _SERIAL_LEAF_1
#endif

// Step 2: For multiserial, handle the second serial port as well
// Step 2: For multiserial wrap all serial ports in a single
// interface with the ability to output to multiple serial ports.
#if HAS_MULTI_SERIAL
#define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
#define _PORT_RESTORE(n,p) RESTORE(n)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/core/serial_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct BaseSerial : public SerialBase< BaseSerial<SerialT> >, public SerialT {

SerialFeature features(serial_index_t index) const { return CALL_IF_EXISTS(SerialFeature, static_cast<const SerialT*>(this), features, index); }

// We have 2 implementation of the same method in both base class, let's say which one we want
// Two implementations of the same method exist in both base classes so indicate the right one
using SerialT::available;
using SerialT::read;
using SerialT::begin;
Expand Down Expand Up @@ -134,7 +134,7 @@ struct ForwardSerial : public SerialBase< ForwardSerial<SerialT> > {
ForwardSerial(const bool e, SerialT & out) : BaseClassT(e), out(out) {}
};

// A class that's can be hooked and unhooked at runtime, useful to capturing the output of the serial interface
// A class that can be hooked and unhooked at runtime, useful to capture the output of the serial interface
template <class SerialT>
struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public SerialT {
typedef SerialBase< RuntimeSerial<SerialT> > BaseClassT;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/control/M7-M9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ void GcodeSuite::M9() {
* M8: Air Assist On
*/
void GcodeSuite::M8() {
planner.synchronize();
planner.synchronize();
cutter.air_assist_enable(); // Turn on Air Assist pin
}

/**
* M9: Air Assist Off
*/
void GcodeSuite::M9() {
planner.synchronize();
planner.synchronize();
cutter.air_assist_disable(); // Turn off Air Assist pin
}

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ void GcodeSuite::process_subcommands_now_P(PGM_P pgcode) {
strncpy_P(cmd, pgcode, len); // Copy the command to the stack
cmd[len] = '\0'; // End with a nul
parser.parse(cmd); // Parse the command
process_parsed_command(true); // Process it
process_parsed_command(true); // Process it (no "ok")
if (!delim) break; // Last command?
pgcode = delim + 1; // Get the next command
}
Expand All @@ -1077,7 +1077,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
char * const delim = strchr(gcode, '\n'); // Get address of next newline
if (delim) *delim = '\0'; // Replace with nul
parser.parse(gcode); // Parse the current command
process_parsed_command(true); // Process it
process_parsed_command(true); // Process it (no "ok")
if (!delim) break; // Last command?
*delim = '\n'; // Put back the newline
gcode = delim + 1; // Get the next command
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/MarlinConfigPre.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#include "../HAL/platforms.h"
#endif

#include "../core/boards.h"
#include "../core/macros.h"
#include "../core/boards.h"
#include "../../Configuration.h"

#ifdef CUSTOM_VERSION_FILE
Expand Down
7 changes: 2 additions & 5 deletions Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,16 @@

#include "../DGUSScreenHandler.h"

#include "../../../../../inc/MarlinConfig.h"

#include "../../../../../MarlinCore.h"
#include "../../../../../gcode/queue.h"
#include "../../../../../libs/duration_t.h"
#include "../../../../../module/settings.h"
#include "../../../../../module/temperature.h"
#include "../../../../../module/motion.h"
#include "../../../../../module/planner.h"
#include "../../../../../module/printcounter.h"
#include "../../../../../sd/cardreader.h"

#include "../../../../../gcode/gcode.h"
#include "../../../../../pins/pins.h"
#include "../../../../../libs/nozzle.h"

#if ENABLED(HAS_STEALTHCHOP)
#include "../../../../../module/stepper/trinamic.h"
Expand Down
Loading

0 comments on commit fccfcfb

Please sign in to comment.