Commit ef15427e authored by Simone Primarosa's avatar Simone Primarosa

Merge pull request #66 from simonepri/master

Update 4.2.0 dev
parents 6f27b4e0 051dcc00
### Version 4.2.0
* New configuration systems (Now you can create a separate file with all configuration and use it in you FW update)
* New namings for file
* Added more documentation inside configuration file
* More checks for feature incompatibility during compilation
* Codeclean
* General bugfix
* Removed legacy support for old configuration (Do not use your old configuration files, namings and position for configuration has changed)
### Version 4.1.5
* Added dot for SD write operation
* Added statistics menu
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//============================================================================
//==================== Change PIN width Configurator Tool ====================
//============================================================================
#ifndef CONFIGURATION_PINS_H
#define CONFIGURATION_PINS_H
//=========================== BASIC ==============================
//X axis pins
#define X_STEP_PIN ORIG_X_STEP_PIN
......@@ -59,10 +60,66 @@
//FAN pin
#define FAN_PIN ORIG_FAN_PIN
//=========================== START YOUR CHANGE ==============================
// Example for change X_MIN_PIN
// #undef X_MIN_PIN
// #define X_MIN_PIN newpin
//============================================================================
//=========================== FEATURE ==============================
#if ENABLED(MKR4)
#define E0E1_CHOICE_PIN -1
#define E0E2_CHOICE_PIN -1
#define E0E3_CHOICE_PIN -1
#define E1E3_CHOICE_PIN -1
#endif //MKR4
#if ENABLED(NPR2)
#define E_MIN_PIN -1
#endif
#if ENABLED(LASERBEAM)
#define LASER_PWR_PIN -1
#define LASER_TTL_PIN -1
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FILRUNOUT_PIN -1
#endif
#if ENABLED(FILAMENT_SENSOR)
#define FILWIDTH_PIN -1 // ANALOG NUMBERING
#endif
#if ENABLED(POWER_CONSUMPTION)
#define POWER_CONSUMPTION_PIN -1 // ANALOG NUMBERING
#endif
#if ENABLED(PHOTOGRAPH)
#define PHOTOGRAPH_PIN -1
#endif
#if ENABLED(CHDK)
#define CHDK_PIN -1
#endif
#if ENABLED(CONTROLLERFAN)
#define CONTROLLERFAN_PIN -1
#endif
#if ENABLED(EXTRUDER_AUTO_FAN)
#define EXTRUDER_0_AUTO_FAN_PIN -1
#define EXTRUDER_1_AUTO_FAN_PIN -1
#define EXTRUDER_2_AUTO_FAN_PIN -1
#define EXTRUDER_3_AUTO_FAN_PIN -1
#endif
#if ENABLED(X2_IS_TMC)
#define X2_ENABLE_PIN -1
#define X2_STEP_PIN -1
#define X2_DIR_PIN -1
#endif
#if ENABLED(Z_PROBE_SLED)
#define SLED_PIN -1
#endif
//============================================================================
#endif
\ No newline at end of file
This diff is collapsed.
#ifndef CONFIGURATION_VERSION_H
#define CONFIGURATION_VERSION_H
/*
* This file is a placeholder for a file which could be distributed in an archive
* It takes the place of an automatically created "_Version.h" which is generated during the build process
......@@ -11,3 +13,4 @@
// It might also be appropriate to define a location where additional information can be found
#define SOURCE_CODE_URL "https://github.com/MagoKimbra/MarlinKimbra"
#endif
#endif
\ No newline at end of file
This diff is collapsed.
#define M100_FREE_MEMORY_DUMPER // Comment out to remove Dump sub-command
#define M100_FREE_MEMORY_CORRUPTOR // Comment out to remove Corrupt sub-command
// M100 Free Memory Watcher
//
// This code watches the free memory block between the bottom of the heap and the top of the stack.
// This memory block is initialized and watched via the M100 command.
//
// M100 I Initializes the free memory block and prints vitals statistics about the area
// M100 F Identifies how much of the free memory block remains free and unused. It also
// detects and reports any corruption within the free memory block that may have
// happened due to errant firmware.
// M100 D Does a hex display of the free memory block along with a flag for any errant
// data that does not match the expected value.
// M100 C x Corrupts x locations within the free memory block. This is useful to check the
// correctness of the M100 F and M100 D commands.
//
// Initial version by Roxy-3DPrintBoard
//
//
#include "Marlin.h"
#ifdef M100_FREE_MEMORY_WATCHER
extern void *__brkval;
extern size_t __heap_start, __heap_end, __flp;
//
// Declare all the functions we need from Marlin_Main.cpp to do the work!
//
float code_value();
long code_value_long();
bool code_seen(char );
//
// Utility functions used by M100 to get its work done.
//
unsigned char *top_of_stack();
void prt_hex_nibble( unsigned int );
void prt_hex_byte(unsigned int );
void prt_hex_word(unsigned int );
int how_many_E5s_are_here( unsigned char *);
void gcode_M100() {
static int m100_not_initialized = 1;
unsigned char *sp, *ptr;
int i, j, n;
//
// M100 D dumps the free memory block from __brkval to the stack pointer.
// malloc() eats memory from the start of the block and the stack grows
// up from the bottom of the block. Solid 0xE5's indicate nothing has
// used that memory yet. There should not be anything but 0xE5's within
// the block of 0xE5's. If there is, that would indicate memory corruption
// probably caused by bad pointers. Any unexpected values will be flagged in
// the right hand column to help spotting them.
//
#ifdef M100_FREE_MEMORY_DUMPER // Comment out to remove Dump sub-command
if ( code_seen('D') ) {
ptr = (unsigned char *) __brkval;
//
// We want to start and end the dump on a nice 16 byte boundry even though
// the values we are using are not 16 byte aligned.
//
ECHO_M("\n__brkval : ");
prt_hex_word( (unsigned int) ptr );
ptr = (unsigned char *) ((unsigned long) ptr & 0xfff0);
sp = top_of_stack();
ECHO_M("\nStack Pointer : ");
prt_hex_word( (unsigned int) sp );
ECHO_M("\n");
sp = (unsigned char *) ((unsigned long) sp | 0x000f);
n = sp - ptr;
//
// This is the main loop of the Dump command.
//
while ( ptr < sp ) {
prt_hex_word( (unsigned int) ptr); // Print the address
ECHO_M(":");
for(i = 0; i < 16; i++) { // and 16 data bytes
prt_hex_byte( *(ptr+i));
ECHO_M(" ");
delay(2);
}
ECHO_M("|"); // now show where non 0xE5's are
for(i = 0; i < 16; i++) {
delay(2);
if ( *(ptr+i)==0xe5)
ECHO_M(" ");
else
ECHO_M("?");
}
ECHO_M("\n");
ptr += 16;
delay(2);
}
ECHO_M("Done.\n");
return;
}
#endif
//
// M100 F requests the code to return the number of free bytes in the memory pool along with
// other vital statistics that define the memory pool.
//
if ( code_seen('F') ) {
int max_addr = (int) __brkval;
int max_cnt = 0;
int block_cnt = 0;
ptr = (unsigned char *) __brkval;
sp = top_of_stack();
n = sp - ptr;
// Scan through the range looking for the biggest block of 0xE5's we can find
for(i = 0; i < n; i++) {
if ( *(ptr+i) == (unsigned char) 0xe5) {
j = how_many_E5s_are_here( (unsigned char *) ptr+i );
if ( j > 8) {
ECHO_MV("Found ", j );
ECHO_M(" bytes free at 0x");
prt_hex_word( (int) ptr+i );
ECHO_M("\n");
i += j;
block_cnt++;
}
if ( j>max_cnt) { // We don't do anything with this information yet
max_cnt = j; // but we do know where the biggest free memory block is.
max_addr = (int) ptr+i;
}
}
}
if (block_cnt>1)
ECHO_EM("\nMemory Corruption detected in free memory area.\n");
ECHO_M("\nDone.\n");
return;
}
//
// M100 C x Corrupts x locations in the free memory pool and reports the locations of the corruption.
// This is useful to check the correctness of the M100 D and the M100 F commands.
//
#ifdef M100_FREE_MEMORY_CORRUPTOR
if ( code_seen('C') ) {
int x; // x gets the # of locations to corrupt within the memory pool
x = code_value();
ECHO_EM("Corrupting free memory block.\n");
ptr = (unsigned char *) __brkval;
ECHO_MV("\n__brkval : ",(long) ptr );
ptr += 8;
sp = top_of_stack();
ECHO_MV("\nStack Pointer : ",(long) sp );
ECHO_EM("\n");
n = sp - ptr - 64; // -64 just to keep us from finding interrupt activity that
// has altered the stack.
j = n / (x+1);
for(i = 1; i <= x; i++) {
*(ptr+(i*j)) = i;
ECHO_M("\nCorrupting address: 0x");
prt_hex_word( (unsigned int) (ptr+(i*j)) );
}
ECHO_EM("\n");
return;
}
#endif
//
// M100 I Initializes the free memory pool so it can be watched and prints vital
// statistics that define the free memory pool.
//
if (m100_not_initialized || code_seen('I') ) { // If no sub-command is specified, the first time
ECHO_EM("Initializing free memory block.\n"); // this happens, it will Initialize.
ptr = (unsigned char *) __brkval; // Repeated M100 with no sub-command will not destroy the
ECHO_MV("\n__brkval : ",(long) ptr ); // state of the initialized free memory pool.
ptr += 8;
sp = top_of_stack();
ECHO_MV("\nStack Pointer : ",(long) sp );
ECHO_EM("\n");
n = sp - ptr - 64; // -64 just to keep us from finding interrupt activity that
// has altered the stack.
ECHO_V( n );
ECHO_EM(" bytes of memory initialized.\n");
for(i = 0; i < n; i++)
*(ptr+i) = (unsigned char) 0xe5;
for(i = 0; i < n; i++) {
if ( *(ptr+i) != (unsigned char) 0xe5 ) {
ECHO_MV("? address : ", (unsigned long) ptr+i );
ECHO_MV("=", *(ptr+i) );
ECHO_EM("\n");
}
}
m100_not_initialized = 0;
ECHO_EM("Done.\n");
return;
}
return;
}
// top_of_stack() returns the location of a variable on its stack frame. The value returned is above
// the stack once the function returns to the caller.
unsigned char *top_of_stack() {
unsigned char x;
return &x + 1; // x is pulled on return;
}
//
// 3 support routines to print hex numbers. We can print a nibble, byte and word
//
void prt_hex_nibble( unsigned int n ) {
if ( n <= 9 )
ECHO_V(n);
else
ECHO_V( (char) ('A'+n-10) );
delay(2);
}
void prt_hex_byte(unsigned int b) {
prt_hex_nibble( ( b & 0xf0 ) >> 4 );
prt_hex_nibble( b & 0x0f );
}
void prt_hex_word(unsigned int w) {
prt_hex_byte( ( w & 0xff00 ) >> 8 );
prt_hex_byte( w & 0x0ff );
}
// how_many_E5s_are_here() is a utility function to easily find out how many 0xE5's are
// at the specified location. Having this logic as a function simplifies the search code.
//
int how_many_E5s_are_here( unsigned char *p) {
int n;
for(n = 0; n < 32000; n++) {
if ( *(p+n) != (unsigned char) 0xe5)
return n-1;
}
return -1;
}
#endif
......@@ -30,27 +30,24 @@
/* All the implementation is done in *.cpp files to get better compatibility with avr-gcc without the Arduino IDE */
/* Use this file to help the Arduino IDE find which Arduino libraries are needed and to keep documentation on GCode */
#include "Configuration.h"
#include "pins.h"
#include "base.h"
#ifdef ULTRA_LCD
#if defined(LCD_I2C_TYPE_PCF8575)
#if ENABLED(DIGIPOT_I2C) || ENABLED(BLINKM)
#include <Wire.h>
#endif
#if ENABLED(ULTRA_LCD)
#if ENABLED(LCD_I2C_TYPE_PCF8575)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#elif defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)
#elif ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)
#include <Wire.h>
#include <LiquidTWI2.h>
#elif defined(DOGLCD)
#elif ENABLED(DOGLCD)
#include <U8glib.h> // library for graphics LCD by Oli Kraus (https://code.google.com/p/u8glib/)
#else
#include <LiquidCrystal.h> // library for character LCD
#endif
#endif
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
#include <SPI.h>
#endif
#if defined(DIGIPOT_I2C)
#include <Wire.h>
#if HAS(DIGIPOTSS)
#include <SPI.h>
#endif
......@@ -20,7 +20,8 @@
Modified 28 September 2010 by Mark Sproul
*/
#include "Marlin.h"
#include "base.h"
#include "MarlinSerial.h"
#ifndef USBCON
......@@ -280,7 +281,6 @@ void MarlinSerial::printFloat(double number, uint8_t digits) {
}
// Preinstantiate Objects //////////////////////////////////////////////////////
MarlinSerial customizedSerial;
#endif // whole file
......
......@@ -19,12 +19,14 @@
Modified 28 September 2010 by Mark Sproul
*/
#ifndef MarlinSerial_h
#define MarlinSerial_h
#include "Marlin.h"
#ifndef MARLINSERIAL_H
#define MARLINSERIAL_H
#ifndef SERIAL_PORT
#define SERIAL_PORT 0
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
// The presence of the UBRRH register is used to detect a UART.
......
This diff is collapsed.
......@@ -4,141 +4,17 @@
#ifndef MARLIN_H
#define MARLIN_H
#define FORCE_INLINE __attribute__((always_inline)) inline
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#ifdef __SAM3X8E__
#include "HAL.h"
#else
#include <util/delay.h>
#include <avr/eeprom.h>
#include "fastio.h"
#endif
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "Configuration.h"
#include "pins.h"
#ifndef SANITYCHECK_H
#error Your Configuration.h and Configuration_adv.h files are outdated!
#endif
#include "Arduino.h"
typedef unsigned long millis_t;
// Arduino < 1.0.0 does not define this, so we need to do it ourselves
#ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p) + 0xA0)
#endif
#include "comunication.h"
void get_command();
void idle(bool ignore_stepper_queue = false);
void manage_inactivity(bool ignore_stepper_queue=false);
#if ENABLED(DUAL_X_CARRIAGE) && HAS_X_ENABLE && HAS_X2_ENABLE
#define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0)
#define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0)
#elif HAS_X_ENABLE
#define enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
#else
#define enable_x() ;
#define disable_x() ;
#endif
#if HAS_Y_ENABLE
#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#else
#define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON)
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#endif
#else
#define enable_y() ;
#define disable_y() ;
#endif
#if HAS_Z_ENABLE
#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON)
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#endif
#else
#define enable_z() ;
#define disable_z() ;
#endif
#if HAS_E0_ENABLE
#define enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e0() /* nothing */
#define disable_e0() /* nothing */
#endif
#if (DRIVER_EXTRUDERS > 1) && HAS_E1_ENABLE
#define enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e1() /* nothing */
#define disable_e1() /* nothing */
#endif
#if (DRIVER_EXTRUDERS > 2) && HAS_E2_ENABLE
#define enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e2() /* nothing */
#define disable_e2() /* nothing */
#endif
#if (DRIVER_EXTRUDERS > 3) && HAS_E3_ENABLE
#define enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e3() /* nothing */
#define disable_e3() /* nothing */
#endif
#define disable_e() {disable_e0(); disable_e1(); disable_e2(); disable_e3();}
/**
* The axis order in all axis related arrays is X, Y, Z, E
*/
#define NUM_AXIS 4
/**
* Axis indices as enumerated constants
*
* A_AXIS and B_AXIS are used by COREXY printers
* X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
*/
enum AxisEnum {X_AXIS=0, A_AXIS=0, Y_AXIS=1, B_AXIS=1, Z_AXIS=2, C_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5, Z_HEAD=5};
enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6, Z2_MIN=7, Z2_MAX=8};
void enable_all_steppers();
void disable_all_steppers();
void FlushSerialRequestResend();
void ok_to_send();
#if ENABLED(DELTA)
#if MECH(DELTA)
float probe_bed(float x, float y);
void set_delta_constants();
void adj_tower_delta(int tower);
......@@ -166,7 +42,7 @@ void ok_to_send();
extern float delta_radius;
extern float delta_diagonal_rod;
#endif
#if ENABLED(SCARA)
#if MECH(SCARA)
void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]);
#endif
......@@ -188,6 +64,9 @@ enum DebugFlags {
DEBUG_DRYRUN = BIT(3),
DEBUG_COMMUNICATION = BIT(4)
};
void clamp_to_software_endstops(float target[3]);
extern uint8_t debugLevel;
extern bool Running;
......@@ -201,17 +80,12 @@ void prepare_arc_move(char isclockwise);
void clamp_to_software_endstops(float target[3]);
extern millis_t previous_cmd_ms;
inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
inline void refresh_cmd_timeout();
#if ENABLED(FAST_PWM_FAN)
void setPwmFrequency(uint8_t pin, int val);
#endif
#ifndef CRITICAL_SECTION_START
#define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
#define CRITICAL_SECTION_END SREG = _sreg;
#endif
extern float homing_feedrate[];
extern bool axis_relative_modes[];
extern int feedrate_multiplier;
......@@ -225,11 +99,6 @@ extern float home_offset[3];
// Hotend offset
#if HOTENDS > 1
#ifndef DUAL_X_CARRIAGE
#define NUM_HOTEND_OFFSETS 2 // only in XY plane
#else
#define NUM_HOTEND_OFFSETS 3 // supports offsets in XYZ plane
#endif
extern float hotend_offset[NUM_HOTEND_OFFSETS][HOTENDS];
#endif // HOTENDS > 1
......@@ -237,7 +106,7 @@ extern float home_offset[3];
extern int old_color; // old color for system NPR2
#endif
#if ENABLED(DELTA)
#if MECH(DELTA)
extern float z_probe_offset[3];
extern float endstop_adj[3];
extern float tower_adj[6];
......@@ -248,7 +117,7 @@ extern float home_offset[3];
extern float z_endstop_adj;
#endif
#if ENABLED(SCARA)
#if MECH(SCARA)
extern float axis_scaling[3]; // Build size scaling
#endif
......@@ -273,7 +142,7 @@ extern int fanSpeed;
#if ENABLED(FAN_SOFT_PWM)
extern unsigned char fanSpeedSoftPwm;
#if HAS_CONTROLLERFAN
#if HAS(CONTROLLERFAN)
extern unsigned char fanSpeedSoftPwm_controller;
#endif
#endif
......@@ -288,7 +157,7 @@ extern int fanSpeed;
extern int meas_delay_cm; //delay distance
#endif
#if HAS_POWER_CONSUMPTION_SENSOR
#if HAS(POWER_CONSUMPTION_SENSOR)
extern float power_consumption_meas; //holds the power consumption as accurately measured
extern unsigned long power_consumption_hour; //holds the power consumption per hour as accurately measured
extern unsigned long startpower;
......@@ -341,4 +210,26 @@ extern uint8_t active_driver;
extern void calculate_volumetric_multipliers();
#if ENABLED(M100_FREE_MEMORY_WATCHER)
extern void *__brkval;
extern size_t __heap_start, __heap_end, __flp;
//
// Declare all the functions we need from Marlin_Main.cpp to do the work!
//
float code_value();
long code_value_long();
bool code_seen(char );
//
// Utility functions used by M100 to get its work done.
//
unsigned char *top_of_stack();
void prt_hex_nibble( unsigned int );
void prt_hex_byte(unsigned int );
void prt_hex_word(unsigned int );
int how_many_E5s_are_here( unsigned char *);
#endif
#endif //MARLIN_H
......@@ -17,7 +17,7 @@
* along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#include "base.h"
#if ENABLED(SDSUPPORT)
#include "Sd2Card.h"
......
......@@ -18,11 +18,11 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#ifndef Sd2Card_h
#define Sd2Card_h
#include "base.h"
#if ENABLED(SDSUPPORT)
/**
* \file
* \brief Sd2Card class for V2 SD/SDHC cards
......
......@@ -18,10 +18,6 @@
* <http://www.gnu.org/licenses/>.
*/
// Warning this file was generated by a program.
#include "Marlin.h"
#include "macros.h"
#if ENABLED(SDSUPPORT)
#ifndef Sd2PinMap_h
#define Sd2PinMap_h
......@@ -434,5 +430,3 @@ static inline __attribute__((always_inline))
}
#endif // Sd2PinMap_h
#endif
......@@ -18,9 +18,10 @@
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#include "base.h"
#if ENABLED(SDSUPPORT)
#include "Marlin_main.h"
#include <stdint.h>
#include "SdBaseFile.h"
//------------------------------------------------------------------------------
// pointer to cwd directory
......@@ -1806,7 +1807,7 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
}
//------------------------------------------------------------------------------
// suppress cpplint warnings with NOLINT comment
#if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
#if ALLOW_DEPRECATED_FUNCTIONS && DISABLED(DOXYGEN)
void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0; // NOLINT
#endif // ALLOW_DEPRECATED_FUNCTIONS
......
......@@ -17,16 +17,12 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#ifndef SdBaseFile_h
#define SdBaseFile_h
/**
* \file
* \brief SdBaseFile class
*/
#include "Marlin.h"
#include "SdFatConfig.h"
#include "SdVolume.h"
//------------------------------------------------------------------------------
......@@ -364,7 +360,7 @@ class SdBaseFile {
uint8_t width, bool printSlash);
//------------------------------------------------------------------------------
// Deprecated functions - suppress cpplint warnings with NOLINT comment
#if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
#if ALLOW_DEPRECATED_FUNCTIONS && DISABLED(DOXYGEN)
public:
/** \deprecated Use:
* bool contiguousRange(uint32_t* bgnBlock, uint32_t* endBlock);
......@@ -479,5 +475,4 @@ class SdBaseFile {
#endif // ALLOW_DEPRECATED_FUNCTIONS
};
#endif // SdBaseFile_h
#endif
......@@ -21,9 +21,6 @@
* \file
* \brief configuration definitions
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#ifndef SdFatConfig_h
#define SdFatConfig_h
#include <stdint.h>
......@@ -120,6 +117,3 @@ uint8_t const SOFT_SPI_SCK_PIN = 13;
/** Total size of the buffer used to store the long filenames */
#define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1)
#endif // SdFatConfig_h
#endif
......@@ -17,9 +17,6 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#ifndef SdFatStructs_h
#define SdFatStructs_h
......@@ -641,6 +638,3 @@ static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) {
return (dir->attributes & DIR_ATT_VOLUME_ID) == 0;
}
#endif // SdFatStructs_h
#endif
......@@ -17,9 +17,6 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#include "SdFatUtil.h"
//------------------------------------------------------------------------------
......@@ -79,4 +76,3 @@ void SdFatUtil::SerialPrint_P(PGM_P str) {
void SdFatUtil::SerialPrintln_P(PGM_P str) {
println_P( str);
}
\ No newline at end of file
#endif
......@@ -17,8 +17,6 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#ifndef SdFatUtil_h
#define SdFatUtil_h
......@@ -26,7 +24,7 @@
* \file
* \brief Useful utility functions.
*/
#include "Marlin.h"
#include "base.h"
#include "MarlinSerial.h"
/** Store and print a string in flash memory.*/
#define PgmPrint(x) SerialPrint_P(PSTR(x))
......@@ -43,6 +41,3 @@ namespace SdFatUtil {
using namespace SdFatUtil; // NOLINT
#endif // #define SdFatUtil_h
#endif
\ No newline at end of file
......@@ -17,9 +17,9 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#include "base.h"
#if ENABLED(SDSUPPORT)
#include "Marlin_main.h"
#include "SdFile.h"
/** Create a file object and open it in the current working directory.
*
......@@ -90,6 +90,4 @@ void SdFile::writeln_P(PGM_P str) {
write_P(str);
write_P(PSTR("\r\n"));
}
#endif
\ No newline at end of file
......@@ -21,9 +21,6 @@
* \file
* \brief SdFile class
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#include "SdBaseFile.h"
#include <Print.h>
#ifndef SdFile_h
......@@ -49,6 +46,3 @@ class SdFile : public SdBaseFile, public Print {
void writeln_P(PGM_P str);
};
#endif // SdFile_h
#endif
\ No newline at end of file
......@@ -17,9 +17,6 @@
* along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#ifndef SdInfo_h
#define SdInfo_h
#include <stdint.h>
......@@ -276,5 +273,3 @@ union csd_t {
csd2_t v2;
};
#endif // SdInfo_h
\ No newline at end of file
#endif
\ No newline at end of file
......@@ -17,7 +17,8 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#include "base.h"
#include "Marlin_main.h"
#if ENABLED(SDSUPPORT)
#include "SdVolume.h"
......
......@@ -17,8 +17,6 @@
* along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "Marlin.h"
#if ENABLED(SDSUPPORT)
#ifndef SdVolume_h
#define SdVolume_h
/**
......@@ -193,7 +191,7 @@ class SdVolume {
}
//------------------------------------------------------------------------------
// Deprecated functions - suppress cpplint warnings with NOLINT comment
#if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
#if ALLOW_DEPRECATED_FUNCTIONS && DISABLED(DOXYGEN)
public:
/** \deprecated Use: bool SdVolume::init(Sd2Card* dev);
* \param[in] dev The SD card where the volume is located.
......@@ -211,4 +209,3 @@ class SdVolume {
#endif // ALLOW_DEPRECATED_FUNCTIONS
};
#endif // SdVolume
\ No newline at end of file
#endif
\ No newline at end of file
#ifndef BASE_H
#define BASE_H
#include "Arduino.h"
#include "pins_arduino.h"
// Arduino < 1.0.0 does not define this, so we need to do it ourselves
#ifndef analogInputToDigitalPin
#define analogInputToDigitalPin(p) ((p) + 0xA0)
#endif
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#ifdef __SAM3X8E__
#include "HAL.h"
#else
#include <util/delay.h>
#include <avr/eeprom.h>
#include "fastio.h"
#endif
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "macros.h"
#include "boards.h"
#include "mechanics.h"
#include "Configuration_Version.h"
#include "Configuration_Basic.h"
#include "Configuration_Overall.h"
#if MECH(CARTESIAN)
#include "Configuration_Cartesian.h"
#elif MECH(COREXY)
#include "Configuration_Core.h"
#elif MECH(COREXZ)
#include "Configuration_Core.h"
#elif MECH(DELTA)
#include "Configuration_Delta.h"
#elif MECH(SCARA)
#include "Configuration_Scara.h"
#endif
#include "Configuration_Feature.h"
#include "Configuration_Overall.h"
#include "language.h"
#include "conditionals.h"
#include "sanitycheck.h"
#include "comunication.h"
typedef unsigned long millis_t;
#endif
\ No newline at end of file
......@@ -2,10 +2,10 @@
blinkm.cpp - Library for controlling a BlinkM over i2c
Created by Tim Koster, August 21 2013.
*/
#include "Marlin.h"
#if ENABLED(BLINKM)
#include "base.h"
#if ENABLED(BLINKM)
#include "blinkm.h"
void SendColors(byte red, byte grn, byte blu) {
......@@ -19,5 +19,4 @@ void SendColors(byte red, byte grn, byte blu) {
Wire.endTransmission();
}
#endif //BLINKM
#endif
\ No newline at end of file
......@@ -3,7 +3,9 @@
Library header file for BlinkM library
*/
#include "Arduino.h"
#include "Wire.h"
#ifndef BLINKM_H
#define BLINKM_H
void SendColors(byte red, byte grn, byte blu);
#endif
\ No newline at end of file
#ifndef BOARDS_H
#define BOARDS_H
#ifndef BOARD_H
#define BOARD_H
// Macros for board type
#define BOARD_UNKNOWN -1
#define BOARD_GEN7_CUSTOM 10 // Gen7 custom (Alfons3 Version) "https://github.com/Alfons3/Generation_7_Electronics"
......@@ -68,4 +69,4 @@
#define MB(board) (MOTHERBOARD==BOARD_##board)
#endif //__BOARDS_H
#endif
\ No newline at end of file
#include "Marlin.h"
#include "base.h"
#if HAS(BUZZER)
#include "buzzer.h"
#include "ultralcd.h"
#if HAS_BUZZER
void buzz(long duration, uint16_t freq) {
void buzz(long duration, uint16_t freq) {
if (freq > 0) {
#if ENABLED(LCD_USE_I2C_BUZZER)
lcd_buzz(duration, freq);
......@@ -31,5 +34,5 @@
else {
delay(duration);
}
}
}
#endif
\ No newline at end of file
#ifndef BUZZER_H
#define BUZZER_H
#define BUZZER_H
#if HAS_BUZZER
void buzz(long duration, uint16_t freq);
#else
FORCE_INLINE void buzz(long duration, uint16_t freq) {}
#endif
void buzz(long duration, uint16_t freq);
#endif //BUZZER_H
#endif
#include "Marlin.h"
#include "cardreader.h"
#include "ultralcd.h"
#include "stepper.h"
#include "temperature.h"
#include "language.h"
#include "base.h"
#if ENABLED(SDSUPPORT)
#include "Marlin_main.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h"
#endif
#include "planner.h"
#include "stepper_indirection.h"
#include "stepper.h"
#include "temperature.h"
#include "ultralcd.h"
#include "cardreader.h"
CardReader::CardReader() {
filesize = 0;
sdpos = 0;
......@@ -657,5 +664,4 @@ void CardReader::printingHasFinished() {
autotempShutdown();
}
}
#endif //SDSUPPORT
#endif
\ No newline at end of file
#ifndef CARDREADER_H
#define CARDREADER_H
#if ENABLED(SDSUPPORT)
#define MAX_DIR_DEPTH 10 // Maximum folder depth
#include "SdFile.h"
......@@ -99,6 +97,4 @@ extern CardReader card;
#define IS_SD_PRINTING (false)
#endif //SDSUPPORT
#endif //__CARDREADER_H
......@@ -16,13 +16,6 @@
#include "MarlinSerial.h"
#endif
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
#include "WString.h"
#ifdef USBCON
......@@ -57,7 +50,7 @@
FORCE_INLINE void PS_PGM(const char *str) {
char ch;
while ((ch = pgm_read_byte(str))) {
MYSERIAL.write(ch);
SERIAL_WRITE(ch);
str++;
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "base.h"
#include "Marlin_main.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h"
#endif
#include "planner.h"
#include "stepper_indirection.h"
#include "stepper.h"
#include "temperature.h"
#include "ultralcd.h"
#include "configuration_store.h"
#if ENABLED(SDSUPPORT)
#include "cardreader.h"
#endif
/**
* configuration_store.cpp
*
......@@ -96,17 +111,6 @@
*
*/
#include "Marlin.h"
#include "language.h"
#include "planner.h"
#include "temperature.h"
#include "ultralcd.h"
#include "configuration_store.h"
#if ENABLED(SDSUPPORT)
#include "cardreader.h"
#endif
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
uint8_t c;
while(size--) {
......@@ -158,7 +162,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, max_e_jerk);
EEPROM_WRITE_VAR(i, home_offset);
#if DISABLED(DELTA)
#if !MECH(DELTA)
EEPROM_WRITE_VAR(i, zprobe_zoffset);
#endif
......@@ -166,7 +170,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, hotend_offset);
#endif
#if ENABLED(DELTA)
#if MECH(DELTA)
EEPROM_WRITE_VAR(i, endstop_adj);
EEPROM_WRITE_VAR(i, delta_radius);
EEPROM_WRITE_VAR(i, delta_diagonal_rod);
......@@ -208,12 +212,12 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, bedKd);
#endif
#if DISABLED(HAS_LCD_CONTRAST)
#if HASNT(LCD_CONTRAST)
const int lcd_contrast = 32;
#endif
EEPROM_WRITE_VAR(i, lcd_contrast);
#if ENABLED(SCARA)
#if MECH(SCARA)
EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats
#endif
......@@ -295,7 +299,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, max_e_jerk);
EEPROM_READ_VAR(i, home_offset);
#if DISABLED(DELTA)
#if !MECH(DELTA)
EEPROM_READ_VAR(i, zprobe_zoffset);
#endif
......@@ -303,7 +307,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, hotend_offset);
#endif
#if ENABLED(DELTA)
#if MECH(DELTA)
EEPROM_READ_VAR(i, endstop_adj);
EEPROM_READ_VAR(i, delta_radius);
EEPROM_READ_VAR(i, delta_diagonal_rod);
......@@ -345,13 +349,13 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, bedKd);
#endif
#if DISABLED(HAS_LCD_CONTRAST)
#if HASNT(LCD_CONTRAST)
int lcd_contrast;
#endif
EEPROM_READ_VAR(i, lcd_contrast);
#if ENABLED(SCARA)
#if MECH(SCARA)
EEPROM_READ_VAR(i, axis_scaling); // 3 floats
#endif
......@@ -418,7 +422,7 @@ void Config_ResetDefault() {
float tmp8[] = DEFAULT_Kd;
#endif // PIDTEMP
#if defined(HOTEND_OFFSET_X) && defined(HOTEND_OFFSET_Y)
#if ENABLED(HOTEND_OFFSET_X) && ENABLED(HOTEND_OFFSET_Y)
float tmp9[] = HOTEND_OFFSET_X;
float tmp10[] = HOTEND_OFFSET_Y;
#else
......@@ -469,7 +473,7 @@ void Config_ResetDefault() {
}
}
#if ENABLED(SCARA)
#if MECH(SCARA)
for (int8_t i = 0; i < NUM_AXIS; i++) {
if (i < COUNT(axis_scaling))
axis_scaling[i] = 1;
......@@ -490,11 +494,11 @@ void Config_ResetDefault() {
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
zprobe_zoffset = Z_PROBE_OFFSET_FROM_EXTRUDER;
#elif !defined(DELTA)
#elif !MECH(DELTA)
zprobe_zoffset = 0;
#endif
#if ENABLED(DELTA)
#if MECH(DELTA)
delta_radius = DEFAULT_DELTA_RADIUS;
delta_diagonal_rod = DEFAULT_DELTA_DIAGONAL_ROD;
endstop_adj[0] = TOWER_A_ENDSTOP_ADJ;
......@@ -526,7 +530,7 @@ void Config_ResetDefault() {
gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED;
#endif
#if ENABLED(HAS_LCD_CONTRAST)
#if HAS(LCD_CONTRAST)
lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif
......@@ -569,14 +573,14 @@ void Config_ResetDefault() {
calculate_volumetric_multipliers();
#ifdef IDLE_OOZING_PREVENT
#if ENABLED(IDLE_OOZING_PREVENT)
IDLE_OOZING_enabled = true;
#endif
ECHO_LM(DB, "Hardcoded Default Settings Loaded");
}
#if !defined(DISABLE_M503)
#if DISABLED(DISABLE_M503)
/**
* Print Configuration Settings - M503
......@@ -598,7 +602,7 @@ void Config_ResetDefault() {
}
#endif //EXTRUDERS > 1
#if ENABLED(SCARA)
#if MECH(SCARA)
if (!forReplay) {
ECHO_LM(DB, "Scaling factors:");
}
......@@ -682,7 +686,7 @@ void Config_ResetDefault() {
}
#endif //HOTENDS > 1
#if ENABLED(DELTA)
#if MECH(DELTA)
if (!forReplay) {
ECHO_LM(DB, "Delta Geometry adjustment:");
}
......@@ -747,7 +751,7 @@ void Config_ResetDefault() {
if (!forReplay) {
ECHO_LM(DB, "PID settings:");
}
#ifdef PIDTEMP
#if ENABLED(PIDTEMP)
for (int e = 0; e < HOTENDS; e++) {
ECHO_SMV(DB, " M301 E", e);
ECHO_MV(" P", PID_PARAM(Kp, e));
......@@ -755,7 +759,7 @@ void Config_ResetDefault() {
ECHO_EMV(" D", unscalePID_d(PID_PARAM(Kd, e)));
}
#endif
#ifdef PIDTEMPBED
#if ENABLED(PIDTEMPBED)
ECHO_SMV(DB, " M304 P", bedKp); // for compatibility with hosts, only echos values for E0
ECHO_MV(" I", unscalePID_i(bedKi));
ECHO_EMV(" D", unscalePID_d(bedKd));
......@@ -813,13 +817,11 @@ void Config_ResetDefault() {
}
}
ConfigSD_PrintSettings(forReplay);
}
void ConfigSD_PrintSettings(bool forReplay) {
// Always have this function, even with SD_SETTINGS disabled, the current values will be shown
#if HAS_POWER_CONSUMPTION_SENSOR
#if HAS(POWER_CONSUMPTION_SENSOR)
if (!forReplay) {
ECHO_LM(DB, "Watt/h consumed:");
}
......@@ -843,7 +845,7 @@ void Config_ResetDefault() {
*
*/
void ConfigSD_ResetDefault() {
#if HAS_POWER_CONSUMPTION_SENSOR
#if HAS(POWER_CONSUMPTION_SENSOR)
power_consumption_hour = 0;
#endif
printer_usage_seconds = 0;
......@@ -859,7 +861,7 @@ void ConfigSD_ResetDefault() {
card.setroot(true);
card.openFile(CFG_SD_FILE, false, true, false);
char buff[CFG_SD_MAX_VALUE_LEN];
#if HAS_POWER_CONSUMPTION_SENSOR
#if HAS(POWER_CONSUMPTION_SENSOR)
ltoa(power_consumption_hour,buff,10);
card.unparseKeyLine(cfgSD_KEY[SD_CFG_PWR], buff);
#endif
......@@ -890,7 +892,7 @@ void ConfigSD_ResetDefault() {
k_idx = ConfigSD_KeyIndex(key);
if(k_idx == -1) continue; //unknow key ignore it
switch(k_idx) {
#if HAS_POWER_CONSUMPTION_SENSOR
#if HAS(POWER_CONSUMPTION_SENSOR)
case SD_CFG_PWR: {
if(addValue) power_consumption_hour += (unsigned long)atol(value);
else power_consumption_hour = (unsigned long)atol(value);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment