Browse Source

Simple rename of hex_print

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
committed by Scott Lahteine
parent
commit
76eff24718
  1. 2
      Marlin/src/HAL/STM32_F4_F7/STM32F7/TMC2660.cpp
  2. 2
      Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
  3. 2
      Marlin/src/feature/tmc_util.cpp
  4. 2
      Marlin/src/gcode/calibrate/M100.cpp
  5. 2
      Marlin/src/gcode/eeprom/M500-M504.cpp
  6. 2
      Marlin/src/gcode/parser.h
  7. 5
      Marlin/src/inc/Conditionals_adv.h
  8. 90
      Marlin/src/libs/hex_print.cpp
  9. 0
      Marlin/src/libs/hex_print.h
  10. 90
      Marlin/src/libs/hex_print_routines.cpp

2
Marlin/src/HAL/STM32_F4_F7/STM32F7/TMC2660.cpp

@ -40,7 +40,7 @@
#include "../../../module/stepper/indirection.h"
#include "../../../module/printcounter.h"
#include "../../../libs/duration_t.h"
#include "../../../libs/hex_print_routines.h"
#include "../../../libs/hex_print.h"
//some default values used in initialization
#define DEFAULT_MICROSTEPPING_VALUE 32

2
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp

@ -28,7 +28,7 @@
#include "../../../MarlinCore.h"
#include "../../../HAL/shared/eeprom_api.h"
#include "../../../libs/hex_print_routines.h"
#include "../../../libs/hex_print.h"
#include "../../../module/configuration_store.h"
#include "../../../lcd/ultralcd.h"
#include "../../../module/stepper.h"

2
Marlin/src/feature/tmc_util.cpp

@ -34,7 +34,7 @@
#if ENABLED(TMC_DEBUG)
#include "../module/planner.h"
#include "../libs/hex_print_routines.h"
#include "../libs/hex_print.h"
#if ENABLED(MONITOR_DRIVER_STATUS)
static uint16_t report_tmc_status_interval; // = 0
#endif

2
Marlin/src/gcode/calibrate/M100.cpp

@ -26,7 +26,7 @@
#include "../gcode.h"
#include "../queue.h"
#include "../../libs/hex_print_routines.h"
#include "../../libs/hex_print.h"
#include "../../MarlinCore.h" // for idle()

2
Marlin/src/gcode/eeprom/M500-M504.cpp

@ -60,7 +60,7 @@ void GcodeSuite::M502() {
#if ENABLED(EEPROM_SETTINGS)
#if ENABLED(MARLIN_DEV_MODE)
#include "../../libs/hex_print_routines.h"
#include "../../libs/hex_print.h"
#endif
/**

2
Marlin/src/gcode/parser.h

@ -31,7 +31,7 @@
//#define DEBUG_GCODE_PARSER
#if ENABLED(DEBUG_GCODE_PARSER)
#include "../libs/hex_print_routines.h"
#include "../libs/hex_print.h"
#endif
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)

5
Marlin/src/inc/Conditionals_adv.h

@ -378,3 +378,8 @@
#if ENABLED(EEPROM_SETTINGS) && NONE(I2C_EEPROM, SPI_EEPROM, QSPI_EEPROM, FLASH_EEPROM_EMULATION, SRAM_EEPROM_EMULATION, SDCARD_EEPROM_EMULATION)
#define NO_EEPROM_SELECTED 1
#endif
// Flag whether hex_print.cpp is used
#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE)
#define NEED_HEX_PRINT 1
#endif

90
Marlin/src/libs/hex_print.cpp

@ -0,0 +1,90 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../inc/MarlinConfig.h"
#include "../gcode/parser.h"
#if NEED_HEX_PRINT
#include "hex_print.h"
#ifdef CPU_32_BIT
constexpr int byte_start = 4;
static char _hex[] = "0x00000000";
#else
constexpr int byte_start = 0;
static char _hex[] = "0x0000";
#endif
char* hex_byte(const uint8_t b) {
_hex[byte_start + 4] = hex_nybble(b >> 4);
_hex[byte_start + 5] = hex_nybble(b);
return &_hex[byte_start + 4];
}
inline void _hex_word(const uint16_t w) {
_hex[byte_start + 2] = hex_nybble(w >> 12);
_hex[byte_start + 3] = hex_nybble(w >> 8);
_hex[byte_start + 4] = hex_nybble(w >> 4);
_hex[byte_start + 5] = hex_nybble(w);
}
char* hex_word(const uint16_t w) {
_hex_word(w);
return &_hex[byte_start + 2];
}
#ifdef CPU_32_BIT
char* hex_long(const uint32_t l) {
_hex[2] = hex_nybble(l >> 28);
_hex[3] = hex_nybble(l >> 24);
_hex[4] = hex_nybble(l >> 20);
_hex[5] = hex_nybble(l >> 16);
_hex_word((uint16_t)(l & 0xFFFF));
return &_hex[2];
}
#endif
char* hex_address(const void * const w) {
#ifdef CPU_32_BIT
(void)hex_long((ptr_int_t)w);
#else
(void)hex_word((ptr_int_t)w);
#endif
return _hex;
}
void print_hex_nybble(const uint8_t n) { SERIAL_CHAR(hex_nybble(n)); }
void print_hex_byte(const uint8_t b) { SERIAL_ECHO(hex_byte(b)); }
void print_hex_word(const uint16_t w) { SERIAL_ECHO(hex_word(w)); }
void print_hex_address(const void * const w) { SERIAL_ECHO(hex_address(w)); }
void print_hex_long(const uint32_t w, const char delimiter) {
SERIAL_ECHOPGM("0x");
for (int B = 24; B >= 8; B -= 8){
print_hex_byte(w >> B);
SERIAL_CHAR(delimiter);
}
print_hex_byte(w);
}
#endif // NEED_HEX_PRINT

0
Marlin/src/libs/hex_print_routines.h → Marlin/src/libs/hex_print.h

90
Marlin/src/libs/hex_print_routines.cpp

@ -1,90 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../inc/MarlinConfig.h"
#include "../gcode/parser.h"
#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE)
#include "hex_print_routines.h"
#ifdef CPU_32_BIT
constexpr int byte_start = 4;
static char _hex[] = "0x00000000";
#else
constexpr int byte_start = 0;
static char _hex[] = "0x0000";
#endif
char* hex_byte(const uint8_t b) {
_hex[byte_start + 4] = hex_nybble(b >> 4);
_hex[byte_start + 5] = hex_nybble(b);
return &_hex[byte_start + 4];
}
inline void _hex_word(const uint16_t w) {
_hex[byte_start + 2] = hex_nybble(w >> 12);
_hex[byte_start + 3] = hex_nybble(w >> 8);
_hex[byte_start + 4] = hex_nybble(w >> 4);
_hex[byte_start + 5] = hex_nybble(w);
}
char* hex_word(const uint16_t w) {
_hex_word(w);
return &_hex[byte_start + 2];
}
#ifdef CPU_32_BIT
char* hex_long(const uint32_t l) {
_hex[2] = hex_nybble(l >> 28);
_hex[3] = hex_nybble(l >> 24);
_hex[4] = hex_nybble(l >> 20);
_hex[5] = hex_nybble(l >> 16);
_hex_word((uint16_t)(l & 0xFFFF));
return &_hex[2];
}
#endif
char* hex_address(const void * const w) {
#ifdef CPU_32_BIT
(void)hex_long((ptr_int_t)w);
#else
(void)hex_word((ptr_int_t)w);
#endif
return _hex;
}
void print_hex_nybble(const uint8_t n) { SERIAL_CHAR(hex_nybble(n)); }
void print_hex_byte(const uint8_t b) { SERIAL_ECHO(hex_byte(b)); }
void print_hex_word(const uint16_t w) { SERIAL_ECHO(hex_word(w)); }
void print_hex_address(const void * const w) { SERIAL_ECHO(hex_address(w)); }
void print_hex_long(const uint32_t w, const char delimiter) {
SERIAL_ECHOPGM("0x");
for (int B = 24; B >= 8; B -= 8){
print_hex_byte(w >> B);
SERIAL_CHAR(delimiter);
}
print_hex_byte(w);
}
#endif // AUTO_BED_LEVELING_UBL || M100_FREE_MEMORY_WATCHER || DEBUG_GCODE_PARSER
Loading…
Cancel
Save