Browse Source

Core updates

pull/1/head
Scott Lahteine 7 years ago
parent
commit
f52a31a275
  1. 2
      Marlin/src/core/enum.h
  2. 8
      Marlin/src/core/language.h
  3. 3
      Marlin/src/core/macros.h
  4. 9
      Marlin/src/core/serial.cpp
  5. 10
      Marlin/src/core/serial.h
  6. 5
      Marlin/src/core/types.h
  7. 128
      Marlin/src/core/utility.cpp
  8. 6
      Marlin/src/core/utility.h

2
Marlin/src/core/enum.h

@ -23,7 +23,7 @@
#ifndef __ENUM_H__ #ifndef __ENUM_H__
#define __ENUM_H__ #define __ENUM_H__
#include "MarlinConfig.h" #include "../inc/MarlinConfig.h"
/** /**
* Axis indices as enumerated constants * Axis indices as enumerated constants

8
Marlin/src/core/language.h

@ -23,7 +23,7 @@
#ifndef LANGUAGE_H #ifndef LANGUAGE_H
#define LANGUAGE_H #define LANGUAGE_H
#include "MarlinConfig.h" #include "../inc/MarlinConfig.h"
#define _UxGT(a) a #define _UxGT(a) a
@ -44,7 +44,7 @@
// //
// ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h" // ==> ALWAYS TRY TO COMPILE MARLIN WITH/WITHOUT "ULTIPANEL" / "ULTRALCD" / "SDSUPPORT" #define IN "Configuration.h"
// ==> ALSO TRY ALL AVAILABLE LANGUAGE OPTIONS // ==> ALSO TRY ALL AVAILABLE LANGUAGE OPTIONS
// See also https://github.com/MarlinFirmware/Marlin/wiki/LCD-Language // See also http://marlinfw.org/docs/development/lcd_language.html
// Languages // Languages
// an Aragonese // an Aragonese
@ -260,7 +260,7 @@
// LCD Menu Messages // LCD Menu Messages
#define LANGUAGE_INCL_(M) STRINGIFY_(language_##M.h) #define LANGUAGE_INCL_(M) STRINGIFY_(../lcd/language/language_##M.h)
#define LANGUAGE_INCL(M) LANGUAGE_INCL_(M) #define LANGUAGE_INCL(M) LANGUAGE_INCL_(M)
#define INCLUDE_LANGUAGE LANGUAGE_INCL(LCD_LANGUAGE) #define INCLUDE_LANGUAGE LANGUAGE_INCL(LCD_LANGUAGE)
@ -310,6 +310,6 @@
#define DISPLAY_CHARSET_ISO10646_1 // use the better font on full graphic displays. #define DISPLAY_CHARSET_ISO10646_1 // use the better font on full graphic displays.
#endif #endif
#include "language_en.h" #include "../lcd/language/language_en.h"
#endif // __LANGUAGE_H #endif // __LANGUAGE_H

3
Marlin/src/core/macros.h

@ -102,6 +102,9 @@
#define DEGREES(r) ((r)*180.0/M_PI) #define DEGREES(r) ((r)*180.0/M_PI)
#define HYPOT2(x,y) (sq(x)+sq(y)) #define HYPOT2(x,y) (sq(x)+sq(y))
#define CIRCLE_AREA(R) (M_PI * sq(R))
#define CIRCLE_CIRC(R) (2.0 * M_PI * (R))
#define SIGN(a) ((a>0)-(a<0)) #define SIGN(a) ((a>0)-(a<0))
// Macros to contrain values // Macros to contrain values

9
Marlin/src/core/serial.cpp

@ -25,6 +25,15 @@
const char errormagic[] PROGMEM = "Error:"; const char errormagic[] PROGMEM = "Error:";
const char echomagic[] PROGMEM = "echo:"; const char echomagic[] PROGMEM = "echo:";
void serialprintPGM(const char * str) {
#ifdef TARGET_LPC1768
MYSERIAL.print(str);
#else
while (char ch = pgm_read_byte(str++)) MYSERIAL.write(ch);
#endif
}
void serial_echopair_P(const char* s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
void serial_echopair_P(const char* s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); } void serial_echopair_P(const char* s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); }
void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }

10
Marlin/src/core/serial.h

@ -23,7 +23,7 @@
#ifndef __SERIAL_H__ #ifndef __SERIAL_H__
#define __SERIAL_H__ #define __SERIAL_H__
#include "src/HAL/HAL.h" #include "../inc/MarlinConfig.h"
//todo: HAL: breaks encapsulation //todo: HAL: breaks encapsulation
// For AVR only, define a serial interface based on configuration // For AVR only, define a serial interface based on configuration
@ -36,13 +36,11 @@
#define MYSERIAL Serial #define MYSERIAL Serial
#endif // BLUETOOTH #endif // BLUETOOTH
#else #else
#include "src/HAL/HAL_AVR/MarlinSerial.h" #include "../HAL/HAL_AVR/MarlinSerial.h"
#define MYSERIAL customizedSerial #define MYSERIAL customizedSerial
#endif #endif
#endif #endif
#include "MarlinConfig.h"
extern const char echomagic[] PROGMEM; extern const char echomagic[] PROGMEM;
extern const char errormagic[] PROGMEM; extern const char errormagic[] PROGMEM;
@ -100,8 +98,6 @@ void serial_spaces(uint8_t count);
// //
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.) // Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
// //
FORCE_INLINE void serialprintPGM(const char* str) { void serialprintPGM(const char* str);
while (char ch = pgm_read_byte(str++)) MYSERIAL.write(ch);
}
#endif // __SERIAL_H__ #endif // __SERIAL_H__

5
Marlin/src/core/types.h

@ -23,6 +23,9 @@
#ifndef __TYPES_H__ #ifndef __TYPES_H__
#define __TYPES_H__ #define __TYPES_H__
typedef unsigned long millis_t; #include <stdint.h>
#include <string.h>
typedef uint32_t millis_t;
#endif #endif

128
Marlin/src/core/utility.cpp

@ -20,9 +20,10 @@
* *
*/ */
#include "Marlin.h"
#include "utility.h" #include "utility.h"
#include "temperature.h"
#include "../Marlin.h"
#include "../module/temperature.h"
void safe_delay(millis_t ms) { void safe_delay(millis_t ms) {
while (ms > 50) { while (ms > 50) {
@ -255,3 +256,126 @@ void safe_delay(millis_t ms) {
} }
#endif // ULTRA_LCD #endif // ULTRA_LCD
#if ENABLED(DEBUG_LEVELING_FEATURE)
#include "../module/probe.h"
#include "../module/motion.h"
#include "../module/stepper.h"
#include "../feature/bedlevel/bedlevel.h"
void log_machine_info() {
SERIAL_ECHOPGM("Machine Type: ");
#if ENABLED(DELTA)
SERIAL_ECHOLNPGM("Delta");
#elif IS_SCARA
SERIAL_ECHOLNPGM("SCARA");
#elif IS_CORE
SERIAL_ECHOLNPGM("Core");
#else
SERIAL_ECHOLNPGM("Cartesian");
#endif
SERIAL_ECHOPGM("Probe: ");
#if ENABLED(PROBE_MANUALLY)
SERIAL_ECHOLNPGM("PROBE_MANUALLY");
#elif ENABLED(FIX_MOUNTED_PROBE)
SERIAL_ECHOLNPGM("FIX_MOUNTED_PROBE");
#elif ENABLED(BLTOUCH)
SERIAL_ECHOLNPGM("BLTOUCH");
#elif HAS_Z_SERVO_ENDSTOP
SERIAL_ECHOLNPGM("SERVO PROBE");
#elif ENABLED(Z_PROBE_SLED)
SERIAL_ECHOLNPGM("Z_PROBE_SLED");
#elif ENABLED(Z_PROBE_ALLEN_KEY)
SERIAL_ECHOLNPGM("Z_PROBE_ALLEN_KEY");
#else
SERIAL_ECHOLNPGM("NONE");
#endif
#if HAS_BED_PROBE
SERIAL_ECHOPAIR("Probe Offset X:", X_PROBE_OFFSET_FROM_EXTRUDER);
SERIAL_ECHOPAIR(" Y:", Y_PROBE_OFFSET_FROM_EXTRUDER);
SERIAL_ECHOPAIR(" Z:", zprobe_zoffset);
#if X_PROBE_OFFSET_FROM_EXTRUDER > 0
SERIAL_ECHOPGM(" (Right");
#elif X_PROBE_OFFSET_FROM_EXTRUDER < 0
SERIAL_ECHOPGM(" (Left");
#elif Y_PROBE_OFFSET_FROM_EXTRUDER != 0
SERIAL_ECHOPGM(" (Middle");
#else
SERIAL_ECHOPGM(" (Aligned With");
#endif
#if Y_PROBE_OFFSET_FROM_EXTRUDER > 0
SERIAL_ECHOPGM("-Back");
#elif Y_PROBE_OFFSET_FROM_EXTRUDER < 0
SERIAL_ECHOPGM("-Front");
#elif X_PROBE_OFFSET_FROM_EXTRUDER != 0
SERIAL_ECHOPGM("-Center");
#endif
if (zprobe_zoffset < 0)
SERIAL_ECHOPGM(" & Below");
else if (zprobe_zoffset > 0)
SERIAL_ECHOPGM(" & Above");
else
SERIAL_ECHOPGM(" & Same Z as");
SERIAL_ECHOLNPGM(" Nozzle)");
#endif
#if HAS_ABL
SERIAL_ECHOPGM("Auto Bed Leveling: ");
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
SERIAL_ECHOPGM("LINEAR");
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
SERIAL_ECHOPGM("BILINEAR");
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
SERIAL_ECHOPGM("3POINT");
#elif ENABLED(AUTO_BED_LEVELING_UBL)
SERIAL_ECHOPGM("UBL");
#endif
if (leveling_is_active()) {
SERIAL_ECHOLNPGM(" (enabled)");
#if ABL_PLANAR
const float diff[XYZ] = {
stepper.get_axis_position_mm(X_AXIS) - current_position[X_AXIS],
stepper.get_axis_position_mm(Y_AXIS) - current_position[Y_AXIS],
stepper.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]
};
SERIAL_ECHOPGM("ABL Adjustment X");
if (diff[X_AXIS] > 0) SERIAL_CHAR('+');
SERIAL_ECHO(diff[X_AXIS]);
SERIAL_ECHOPGM(" Y");
if (diff[Y_AXIS] > 0) SERIAL_CHAR('+');
SERIAL_ECHO(diff[Y_AXIS]);
SERIAL_ECHOPGM(" Z");
if (diff[Z_AXIS] > 0) SERIAL_CHAR('+');
SERIAL_ECHO(diff[Z_AXIS]);
#elif ENABLED(AUTO_BED_LEVELING_UBL)
SERIAL_ECHOPAIR("UBL Adjustment Z", stepper.get_axis_position_mm(Z_AXIS) - current_position[Z_AXIS]);
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
SERIAL_ECHOPAIR("ABL Adjustment Z", bilinear_z_offset(current_position));
#endif
}
else
SERIAL_ECHOLNPGM(" (disabled)");
SERIAL_EOL();
#elif ENABLED(MESH_BED_LEVELING)
SERIAL_ECHOPGM("Mesh Bed Leveling");
if (leveling_is_active()) {
float lz = current_position[Z_AXIS];
planner.apply_leveling(current_position[X_AXIS], current_position[Y_AXIS], lz);
SERIAL_ECHOLNPGM(" (enabled)");
SERIAL_ECHOPAIR("MBL Adjustment Z", lz);
}
else
SERIAL_ECHOPGM(" (disabled)");
SERIAL_EOL();
#endif // MESH_BED_LEVELING
}
#endif // DEBUG_LEVELING_FEATURE

6
Marlin/src/core/utility.h

@ -23,6 +23,8 @@
#ifndef __UTILITY_H__ #ifndef __UTILITY_H__
#define __UTILITY_H__ #define __UTILITY_H__
#include "../inc/MarlinConfig.h"
void safe_delay(millis_t ms); void safe_delay(millis_t ms);
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
@ -83,4 +85,8 @@ void safe_delay(millis_t ms);
#endif // ULTRA_LCD #endif // ULTRA_LCD
#if ENABLED(DEBUG_LEVELING_FEATURE)
void log_machine_info();
#endif
#endif // __UTILITY_H__ #endif // __UTILITY_H__

Loading…
Cancel
Save