Merge branch 'bugfix-2.1.x' into pr/27804
This commit is contained in:
@@ -1960,8 +1960,8 @@
|
||||
#if ENABLED(MULTI_VOLUME)
|
||||
#define VOLUME_SD_ONBOARD
|
||||
#define VOLUME_USB_FLASH_DRIVE
|
||||
#define DEFAULT_VOLUME SV_SD_ONBOARD
|
||||
#define DEFAULT_SHARED_VOLUME SV_USB_FLASH_DRIVE
|
||||
#define DEFAULT_VOLUME SD_ONBOARD // :[ 'SD_ONBOARD', 'USB_FLASH_DRIVE' ]
|
||||
#define DEFAULT_SHARED_VOLUME USB_FLASH_DRIVE // :[ 'SD_ONBOARD', 'USB_FLASH_DRIVE' ]
|
||||
#endif
|
||||
|
||||
#endif // HAS_MEDIA
|
||||
@@ -2352,6 +2352,24 @@
|
||||
//#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L.
|
||||
//#define LA_DEBUG // Print debug information to serial during operation. Disable for production use.
|
||||
//#define EXPERIMENTAL_I2S_LA // Allow I2S_STEPPER_STREAM to be used with LA. Performance degrades as the LA step rate reaches ~20kHz.
|
||||
|
||||
//#define SMOOTH_LIN_ADVANCE // Remove limits on acceleration by gradual increase of nozzle pressure
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
/**
|
||||
* ADVANCE_TAU is also the time ahead that the smoother needs to look
|
||||
* into the planner, so the planner needs to have enough blocks loaded.
|
||||
* For k=0.04 at 10k acceleration and an "Orbiter 2" extruder it can be as low as 0.0075.
|
||||
* Adjust by lowering the value until you observe the extruder skipping, then raise slightly.
|
||||
* Higher k and higher XY acceleration may require larger ADVANCE_TAU to avoid skipping steps.
|
||||
*/
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
#define ADVANCE_TAU { 0.01 } // (s) Smoothing time to reduce extruder acceleration, per extruder
|
||||
#else
|
||||
#define ADVANCE_TAU 0.01 // (s) Smoothing time to reduce extruder acceleration
|
||||
#endif
|
||||
#define SMOOTH_LIN_ADV_HZ 5000 // (Hz) How often to update extruder speed
|
||||
#define INPUT_SHAPING_E_SYNC // Synchronize the extruder-shaped XY axes (to increase precision)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
//#define STRING_DISTRIBUTION_DATE "2025-04-18"
|
||||
//#define STRING_DISTRIBUTION_DATE "2025-05-02"
|
||||
|
||||
/**
|
||||
* The protocol for communication to the host. Protocol indicates communication
|
||||
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
static void isr_on() { sei(); }
|
||||
static void isr_off() { cli(); }
|
||||
|
||||
static void delay_ms(const int ms) { _delay_ms(ms); }
|
||||
static void delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
// Tasks, called from idle()
|
||||
static void idletask() {}
|
||||
|
||||
@@ -363,8 +363,11 @@
|
||||
#define AIO7_PWM 0
|
||||
#define AIO7_DDR DDRF
|
||||
|
||||
//-- Begin not supported by Teensyduino
|
||||
//-- don't use Arduino functions on these pins pinMode/digitalWrite/etc
|
||||
//-- 46-47 are not supported by Teensyduino
|
||||
//-- Don't use Arduino functions (pinMode, digitalWrite, etc.) on these pins
|
||||
#define PIN_E2 46
|
||||
#define PIN_E3 47
|
||||
|
||||
#define DIO46_PIN PINE2
|
||||
#define DIO46_RPORT PINE
|
||||
#define DIO46_WPORT PORTE
|
||||
@@ -377,10 +380,7 @@
|
||||
#define DIO47_PWM 0
|
||||
#define DIO47_DDR DDRE
|
||||
|
||||
#define TEENSY_E2 46
|
||||
#define TEENSY_E3 47
|
||||
|
||||
//-- end not supported by Teensyduino
|
||||
//--
|
||||
|
||||
#undef PA0
|
||||
#define PA0_PIN PINA0
|
||||
|
||||
@@ -377,16 +377,16 @@ void printPinPort(const pin_t pin) { // print port number
|
||||
uint8_t x;
|
||||
SERIAL_ECHOPGM(" Port: ");
|
||||
#if AVR_AT90USB1286_FAMILY
|
||||
x = (pin == 46 || pin == 47) ? 'E' : digitalPinToPort_DEBUG(pin) + 64;
|
||||
x = (pin == PIN_E2 || pin == PIN_E3) ? 'E' : 'A' + digitalPinToPort_DEBUG(pin) - 1;
|
||||
#else
|
||||
x = digitalPinToPort_DEBUG(pin) + 64;
|
||||
x = 'A' + digitalPinToPort_DEBUG(pin) - 1;
|
||||
#endif
|
||||
SERIAL_CHAR(x);
|
||||
|
||||
#if AVR_AT90USB1286_FAMILY
|
||||
if (pin == 46)
|
||||
if (pin == PIN_E2)
|
||||
x = '2';
|
||||
else if (pin == 47)
|
||||
else if (pin == PIN_E3)
|
||||
x = '3';
|
||||
else {
|
||||
uint8_t temp = digitalPinToBitMask_DEBUG(pin);
|
||||
|
||||
@@ -102,6 +102,10 @@ void watchdogSetup() {
|
||||
|
||||
#if ENABLED(USE_WATCHDOG)
|
||||
|
||||
#ifndef WATCHDOG_PIO_RESET
|
||||
#define WATCHDOG_PIO_RESET
|
||||
#endif
|
||||
|
||||
// 4 seconds timeout
|
||||
uint32_t timeout = TERN(WATCHDOG_DURATION_8S, 8000, 4000);
|
||||
|
||||
@@ -115,15 +119,16 @@ void watchdogSetup() {
|
||||
timeout = 0xFFF;
|
||||
|
||||
// We want to enable the watchdog with the specified timeout
|
||||
uint32_t value =
|
||||
WDT_MR_WDV(timeout) | // With the specified timeout
|
||||
WDT_MR_WDD(timeout) | // and no invalid write window
|
||||
#if !(SAMV70 || SAMV71 || SAME70 || SAMS70)
|
||||
WDT_MR_WDRPROC | // WDT fault resets processor only - We want
|
||||
// to keep PIO controller state
|
||||
#endif
|
||||
WDT_MR_WDDBGHLT | // WDT stops in debug state.
|
||||
WDT_MR_WDIDLEHLT; // WDT stops in idle state.
|
||||
uint32_t value = (0
|
||||
| WDT_MR_WDV(timeout) // With the specified timeout
|
||||
| WDT_MR_WDD(timeout) // and no invalid write window
|
||||
#if NONE(WATCHDOG_PIO_RESET, SAMV70, SAMV71, SAME70, SAMS70)
|
||||
| WDT_MR_WDRPROC // WDT fault resets processor only with this flag.
|
||||
// Omit to also reset the PIO controller.
|
||||
#endif
|
||||
| WDT_MR_WDDBGHLT // WDT stops in debug state.
|
||||
| WDT_MR_WDIDLEHLT // WDT stops in idle state.
|
||||
);
|
||||
|
||||
#if ENABLED(WATCHDOG_RESET_MANUAL)
|
||||
// We enable the watchdog timer, but only for the interrupt.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_SAM
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
@@ -132,7 +132,7 @@ static uint8_t buffer[256] = {0}, // The RAM buffer to accumulate writes
|
||||
curGroup = 0xFF; // Current FLASH group
|
||||
|
||||
#define DEBUG_OUT ENABLED(EE_EMU_DEBUG)
|
||||
#include "../../core/debug_out.h"
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
static void ee_Dump(const int page, const void *data) {
|
||||
|
||||
@@ -953,7 +953,7 @@ static void ee_Init() {
|
||||
|
||||
/* PersistentStore -----------------------------------------------------------*/
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_SAM
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||
@@ -40,11 +40,12 @@
|
||||
* Some jitter in the Vref signal is OK so the interrupt priority is left at its default value.
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if MB(PRINTRBOARD_G2)
|
||||
|
||||
#include "G2_PWM.h"
|
||||
#include "../../../module/stepper.h"
|
||||
|
||||
#if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
|
||||
#define G2_PWM_X 1
|
||||
|
||||
@@ -26,10 +26,7 @@
|
||||
* PR #7500. It is hardwired for the PRINTRBOARD_G2 Motor Current needs.
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../../../module/stepper.h"
|
||||
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\module\stepper.h
|
||||
//C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\HAL\HAL_DUE\G2_PWM.h
|
||||
#include <stdint.h>
|
||||
|
||||
#define PWM_PERIOD_US 100 // base repetition rate in micro seconds
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
#include "compiler.h"
|
||||
#include "preprocessor.h"
|
||||
#ifdef FREERTOS_USED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#include <FreeRTOS.h>
|
||||
#include <semphr.h>
|
||||
#endif
|
||||
#include "ctrl_access.h"
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ void sd_mmc_spi_mem_init() {
|
||||
}
|
||||
|
||||
inline bool media_ready() {
|
||||
return IS_SD_MOUNTED() && IS_SD_INSERTED() && !IS_SD_FILE_OPEN() && !IS_SD_PRINTING();
|
||||
return card.isMounted() && card.isInserted() && !card.isFileOpen() && !card.isStillPrinting();
|
||||
}
|
||||
|
||||
bool sd_mmc_spi_unload(bool) { return true; }
|
||||
@@ -29,11 +29,10 @@ bool sd_mmc_spi_wr_protect() { return false; }
|
||||
bool sd_mmc_spi_removal() { return !media_ready(); }
|
||||
|
||||
Ctrl_status sd_mmc_spi_test_unit_ready() {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
#if ENABLED(DISABLE_DUE_SD_MMC)
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
||||
return CTRL_GOOD;
|
||||
return sd_mmc_spi_removal() ? CTRL_NO_PRESENT : CTRL_GOOD;
|
||||
}
|
||||
|
||||
// NOTE: This function is defined as returning the address of the last block
|
||||
@@ -58,9 +57,10 @@ uint8_t sector_buf[SD_MMC_BLOCK_SIZE];
|
||||
// #define DEBUG_MMC
|
||||
|
||||
Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
#if ENABLED(DISABLE_DUE_SD_MMC)
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
|
||||
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
||||
|
||||
#ifdef DEBUG_MMC
|
||||
@@ -97,9 +97,10 @@ Ctrl_status sd_mmc_spi_usb_read_10(uint32_t addr, uint16_t nb_sector) {
|
||||
}
|
||||
|
||||
Ctrl_status sd_mmc_spi_usb_write_10(uint32_t addr, uint16_t nb_sector) {
|
||||
#ifdef DISABLE_DUE_SD_MMC
|
||||
#if ENABLED(DISABLE_DUE_SD_MMC)
|
||||
return CTRL_NO_PRESENT;
|
||||
#endif
|
||||
|
||||
if (sd_mmc_spi_removal()) return CTRL_NO_PRESENT;
|
||||
|
||||
#ifdef DEBUG_MMC
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include "wifi.h"
|
||||
#include "wifi/wifi.h"
|
||||
#if ENABLED(OTASUPPORT)
|
||||
#include "ota.h"
|
||||
#include "wifi/ota.h"
|
||||
#endif
|
||||
#if ENABLED(WEBSUPPORT)
|
||||
#include "spiffs.h"
|
||||
#include "web.h"
|
||||
#include "wifi/spiffs.h"
|
||||
#include "wifi/web.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -175,8 +175,6 @@ uint8_t MarlinHAL::get_reset_source() { return rtc_get_reset_reason(1); }
|
||||
|
||||
void MarlinHAL::reboot() { ESP.restart(); }
|
||||
|
||||
void _delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
// return free memory between end of heap (or end bss) and whatever is current
|
||||
int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
#include "i2s.h"
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
#include "WebSocketSerial.h"
|
||||
#include "wifi/WebSocketSerial.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
#include "esp3dlib.h"
|
||||
#include <esp3dlib.h>
|
||||
#endif
|
||||
|
||||
#include "FlushableHardwareSerial.h"
|
||||
@@ -165,8 +165,6 @@ int freeMemory();
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void _delay_ms(const int ms);
|
||||
|
||||
// ------------------------
|
||||
// MarlinHAL Class
|
||||
// ------------------------
|
||||
@@ -194,7 +192,7 @@ public:
|
||||
static void isr_on() { if (spinlock.owner != portMUX_FREE_VAL) portEXIT_CRITICAL(&spinlock); }
|
||||
static void isr_off() { portENTER_CRITICAL(&spinlock); }
|
||||
|
||||
static void delay_ms(const int ms) { _delay_ms(ms); }
|
||||
static void delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
// Tasks, called from idle()
|
||||
static void idletask();
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#if HAS_MEDIA
|
||||
#include "../../sd/cardreader.h"
|
||||
#if ENABLED(ESP3D_WIFISUPPORT)
|
||||
#include "sd_ESP32.h"
|
||||
#include <sd_ESP32.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../core/serial_hook.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../../core/serial_hook.h"
|
||||
|
||||
#include <Stream.h>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#undef ENABLED
|
||||
#undef DISABLED
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ALL(WIFISUPPORT, OTASUPPORT)
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ALL(WIFISUPPORT, WEBSUPPORT)
|
||||
|
||||
#include "../../core/serial.h"
|
||||
#include "../../../core/serial.h"
|
||||
|
||||
#include <FS.h>
|
||||
#include <SPIFFS.h>
|
||||
@@ -21,11 +21,11 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ALL(WIFISUPPORT, WEBSUPPORT)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#undef DISABLED // esp32-hal-gpio.h
|
||||
#include <SPIFFS.h>
|
||||
@@ -21,11 +21,11 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(WIFISUPPORT)
|
||||
|
||||
#include "../../core/serial.h"
|
||||
#include "../../../core/serial.h"
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <ESPmDNS.h>
|
||||
@@ -60,10 +60,9 @@ MarlinSerial& MarlinSerial::get_instance(usart::USART_Base Base, pin_size_t rxPi
|
||||
static MarlinSerial* current_serial_instance = nullptr;
|
||||
|
||||
static void emergency_callback() {
|
||||
if (current_serial_instance) {
|
||||
uint8_t last_data = current_serial_instance->get_last_data();
|
||||
emergency_parser.update(current_serial_instance->emergency_state, last_data);
|
||||
}
|
||||
if (!current_serial_instance) return;
|
||||
const uint8_t last_data = current_serial_instance->get_last_data();
|
||||
emergency_parser.update(current_serial_instance->emergency_state, last_data);
|
||||
}
|
||||
|
||||
void MarlinSerial::register_emergency_callback(void (*callback)()) {
|
||||
@@ -72,26 +71,23 @@ MarlinSerial& MarlinSerial::get_instance(usart::USART_Base Base, pin_size_t rxPi
|
||||
#endif
|
||||
|
||||
void MarlinSerial::begin(unsigned long baudrate, uint16_t config) {
|
||||
UsartSerial::begin(baudrate, config);
|
||||
#if DISABLED(SERIAL_DMA)
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
current_serial_instance = this;
|
||||
register_emergency_callback(emergency_callback);
|
||||
#endif
|
||||
UsartSerial::begin(baudrate, config, ENABLED(SERIAL_DMA));
|
||||
#if ENABLED(EMERGENCY_PARSER) && DISABLED(SERIAL_DMA)
|
||||
current_serial_instance = this;
|
||||
register_emergency_callback(emergency_callback);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MarlinSerial::updateRxDmaBuffer() {
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
// Get the number of bytes available in the receive buffer
|
||||
size_t available_bytes = usart_.available_for_read(true);
|
||||
uint8_t data;
|
||||
const size_t available_bytes = usart_.available_for_read(true);
|
||||
|
||||
// Process only the available data
|
||||
for (size_t i = 0; i < available_bytes; ++i) {
|
||||
if (usart_.read_rx_buffer(data)) {
|
||||
uint8_t data;
|
||||
if (usart_.read_rx_buffer(data))
|
||||
emergency_parser.update(emergency_state, data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Call the base class implementation to handle any additional updates
|
||||
|
||||
+4
-4
@@ -25,16 +25,16 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_MFL
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
||||
+4
-4
@@ -25,16 +25,16 @@
|
||||
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_MFL
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../../libs/BL24CXX.h"
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../../../libs/BL24CXX.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
|
||||
void eeprom_init() {
|
||||
BL24CXX::init();
|
||||
+4
-4
@@ -19,11 +19,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_MFL
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||
@@ -27,9 +27,12 @@
|
||||
#include <PinOps.hpp>
|
||||
#include <PinOpsMap.hpp>
|
||||
|
||||
static inline void fast_write_pin_wrapper(pin_size_t IO, bool V) {
|
||||
if (V) gpio::fast_set_pin(getPortFromPin(IO), getPinInPort(IO));
|
||||
else gpio::fast_clear_pin(getPortFromPin(IO), getPinInPort(IO));
|
||||
template<typename T>
|
||||
static inline void fast_write_pin_wrapper(pin_size_t IO, T V) {
|
||||
auto port = getPortFromPin(IO);
|
||||
auto pin = getPinInPort(IO);
|
||||
if (static_cast<bool>(V)) gpio::fast_set_pin(port, pin);
|
||||
else gpio::fast_clear_pin(port, pin);
|
||||
}
|
||||
|
||||
static inline bool fast_read_pin_wrapper(pin_size_t IO) {
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
// If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_MFL
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../shared/Delay.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../shared/Delay.h"
|
||||
|
||||
#include "SDCard.h"
|
||||
#include <string.h>
|
||||
@@ -16,9 +16,9 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#include "SDIO.hpp"
|
||||
#include <SDIO.hpp>
|
||||
|
||||
namespace sdio {
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_MFL
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(ONBOARD_SDIO)
|
||||
|
||||
@@ -215,7 +215,6 @@ void DMA1_IRQHandler() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
void SDIO_IRQHandler(void) {
|
||||
@@ -228,6 +227,5 @@ extern "C" {
|
||||
|
||||
} // extern "C"
|
||||
|
||||
|
||||
#endif // ONBOARD_SDIO
|
||||
#endif // ARDUINO_ARCH_MFL
|
||||
@@ -27,7 +27,7 @@
|
||||
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#include HAL_PATH(..,HAL.h)
|
||||
#include HAL_PATH(.., HAL.h)
|
||||
extern MarlinHAL hal;
|
||||
|
||||
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
|
||||
|
||||
+3
-3
@@ -26,12 +26,12 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
||||
+3
-3
@@ -26,12 +26,12 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../../libs/BL24CXX.h"
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../../../libs/BL24CXX.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
|
||||
void eeprom_init() {
|
||||
BL24CXX::init();
|
||||
+3
-3
@@ -25,12 +25,12 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../sd/cardreader.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
#include "../../../sd/cardreader.h"
|
||||
|
||||
#define EEPROM_FILENAME "eeprom.dat"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
static void isr_on() {}
|
||||
static void isr_off() {}
|
||||
|
||||
static void delay_ms(const int ms) { _delay_ms(ms); }
|
||||
static void delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
// Tasks, called from idle()
|
||||
static void idletask() {}
|
||||
|
||||
@@ -31,8 +31,6 @@ void cli() { } // Disable
|
||||
void sei() { } // Enable
|
||||
|
||||
// Time functions
|
||||
void _delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
unsigned long millis() {
|
||||
return (unsigned long)Clock::millis();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ extern "C" {
|
||||
|
||||
// Time functions
|
||||
extern "C" void delay(const int ms);
|
||||
void _delay_ms(const int ms);
|
||||
void delayMicroseconds(unsigned long);
|
||||
unsigned long millis();
|
||||
|
||||
|
||||
@@ -173,13 +173,8 @@ void MarlinHAL::init() {
|
||||
// HAL idle task
|
||||
void MarlinHAL::idletask() {
|
||||
#if HAS_SHARED_MEDIA
|
||||
// If Marlin is using the SD card we need to lock it to prevent access from
|
||||
// a PC via USB.
|
||||
// Other HALs use IS_SD_PRINTING() and IS_SD_FILE_OPEN() to check for access but
|
||||
// this will not reliably detect delete operations. To be safe we will lock
|
||||
// the disk if Marlin has it mounted. Unfortunately there is currently no way
|
||||
// to unmount the disk from the LCD menu.
|
||||
// if (IS_SD_PRINTING() || IS_SD_FILE_OPEN())
|
||||
// When Marlin is using the SD Card it must be locked to prevent PC access via USB.
|
||||
// For maximum safety we lock the disk if Marlin has it mounted for any reason.
|
||||
if (card.isMounted())
|
||||
MSC_Aquire_Lock();
|
||||
else
|
||||
|
||||
+2
-2
@@ -36,11 +36,11 @@
|
||||
* 16Kb I/O buffers (intended to hold DMA USB and Ethernet data, but currently
|
||||
* unused).
|
||||
*/
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
extern "C" {
|
||||
#include <lpc17xx_iap.h>
|
||||
+3
-3
@@ -26,13 +26,13 @@
|
||||
|
||||
#ifdef TARGET_LPC1768
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION)
|
||||
|
||||
//#define DEBUG_SD_EEPROM_EMULATION
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#include <chanfs/diskio.h>
|
||||
#include <chanfs/ff.h>
|
||||
@@ -52,7 +52,6 @@ bool eeprom_file_open = false;
|
||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
const char eeprom_erase_value = 0xFF;
|
||||
MSC_Aquire_Lock();
|
||||
if (f_mount(&fat_fs, "", 1)) {
|
||||
MSC_Release_Lock();
|
||||
@@ -65,6 +64,7 @@ bool PersistentStore::access_start() {
|
||||
UINT bytes_written;
|
||||
FSIZE_t file_size = f_size(&eeprom_file);
|
||||
f_lseek(&eeprom_file, file_size);
|
||||
const char eeprom_erase_value = 0xFF;
|
||||
while (file_size < capacity() && res == FR_OK) {
|
||||
res = f_write(&eeprom_file, &eeprom_erase_value, 1, &bytes_written);
|
||||
file_size++;
|
||||
+3
-3
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#ifdef TARGET_LPC1768
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
* with implementations supplied by the framework.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE 0x8000 // 32K
|
||||
@@ -52,7 +52,9 @@ uint8_t _getc();
|
||||
// ------------------------
|
||||
|
||||
#define CPU_32_BIT
|
||||
#define SHARED_SERVOS HAS_SERVOS // Use shared/servos.cpp
|
||||
|
||||
class Servo;
|
||||
typedef Servo hal_servo_t;
|
||||
|
||||
#define F_CPU 100000000
|
||||
#define SystemCoreClock F_CPU
|
||||
@@ -193,7 +195,7 @@ public:
|
||||
static void isr_on() {}
|
||||
static void isr_off() {}
|
||||
|
||||
static void delay_ms(const int ms) { _delay_ms(ms); }
|
||||
static void delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
// Tasks, called from idle()
|
||||
static void idletask();
|
||||
@@ -232,8 +234,10 @@ public:
|
||||
* No option to invert the duty cycle [default = false]
|
||||
* No option to change the scale of the provided value to enable finer PWM duty control [default = 255]
|
||||
*/
|
||||
static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t=255, const bool=false) {
|
||||
analogWrite(pin, v);
|
||||
static void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size=255, const bool invert=false) {
|
||||
auto value = map(v, 0, v_size, 0, UINT16_MAX);
|
||||
value = invert ? UINT16_MAX - value : value;
|
||||
analogWrite(pin, value);
|
||||
}
|
||||
|
||||
static void set_pwm_frequency(const pin_t, int) {}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2025 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 "../platforms.h"
|
||||
|
||||
#ifdef __PLAT_NATIVE_SIM__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_SERVOS
|
||||
|
||||
#include "Servo.h"
|
||||
|
||||
//#define DEBUG_SERVOS
|
||||
#define DEBUG_OUT ENABLED(DEBUG_SERVOS)
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
uint8_t ServoCount = 0; // the total number of attached servos
|
||||
|
||||
Servo::Servo() {
|
||||
// Constructor stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: constructor");
|
||||
this->servoIndex = ServoCount++; // assign a servo index to this instance
|
||||
}
|
||||
|
||||
uint8_t Servo::attach(int pin) {
|
||||
// Attach stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: attach to pin ", pin, " servo index ", this->servoIndex);
|
||||
return attach(pin, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
|
||||
}
|
||||
|
||||
uint8_t Servo::attach(int pin, int min, int max) {
|
||||
// Attach with min and max stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: attach to pin ", pin, " with min ", min, " and max ", max);
|
||||
if (pin > 0) servo_pin = pin;
|
||||
return this->servoIndex;
|
||||
}
|
||||
|
||||
void Servo::detach() {
|
||||
// Detach stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: detach");
|
||||
}
|
||||
|
||||
// If value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
|
||||
void Servo::write(int value) {
|
||||
if (value < MIN_PULSE_WIDTH) { // treat values less than 544 as angles in degrees (valid values in microseconds are handled as microseconds)
|
||||
value = map(constrain(value, 0, 180), 0, 180, SERVO_MIN_US(min), SERVO_MAX_US(max));
|
||||
}
|
||||
writeMicroseconds(value);
|
||||
DEBUG_ECHOLNPGM("Debug Servo: write ", value);
|
||||
}
|
||||
|
||||
void Servo::writeMicroseconds(int value) {
|
||||
// Simulate the servo movement
|
||||
this->value = value;
|
||||
hal.set_pwm_duty(pin_t(this->servo_pin), (float(value) / 20000) * UINT16_MAX, UINT16_MAX);
|
||||
DEBUG_ECHOLNPGM("Debug Servo: write microseconds ", value);
|
||||
}
|
||||
|
||||
int Servo::read() {
|
||||
// Read stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: read ", this->value);
|
||||
return this->value;
|
||||
}
|
||||
|
||||
int Servo::readMicroseconds() {
|
||||
// Read microseconds stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: read microseconds");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Servo::attached() {
|
||||
// Attached stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: attached");
|
||||
return false;
|
||||
}
|
||||
|
||||
int Servo::move(const unsigned char cmd) {
|
||||
// Move stub
|
||||
DEBUG_ECHOLNPGM("Debug Servo: move ", cmd);
|
||||
write(cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // HAS_SERVOS
|
||||
#endif // __PLAT_NATIVE_SIM__
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2025 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/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
|
||||
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
|
||||
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
|
||||
#define SERVO_MIN_US(v) (MIN_PULSE_WIDTH - (v) * 4) // minimum value in uS for this servo
|
||||
#define SERVO_MAX_US(v) (MAX_PULSE_WIDTH - (v) * 4) // maximum value in uS for this servo
|
||||
|
||||
class Servo {
|
||||
public:
|
||||
Servo();
|
||||
uint8_t attach(int pin); // Attach the given pin to the next free channel, set pinMode, return channel number or INVALID_SERVO if failure
|
||||
uint8_t attach(int pin, int min, int max); // As above but also set min and max values for writes.
|
||||
void detach();
|
||||
void write(int value); // If value is < 200 it's treated as an angle, otherwise as pulse width in microseconds
|
||||
void writeMicroseconds(int value); // Write pulse width in microseconds
|
||||
int read(); // Return current pulse width as an angle between 0 and 180 degrees
|
||||
int readMicroseconds(); // Return current pulse width in microseconds for this servo
|
||||
bool attached(); // Return true if this servo is attached, otherwise false
|
||||
int move (const unsigned char cmd);
|
||||
private:
|
||||
uint8_t servoIndex; // Index into the channel data for this servo
|
||||
int8_t min; // Minimum is this value times 4 added to MIN_PULSE_WIDTH
|
||||
int8_t max; // Maximum is this value times 4 added to MAX_PULSE_WIDTH
|
||||
int value; // Pulse width in microseconds for this servo
|
||||
int servo_pin = 0; // pin number for this servo
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2025 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/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#error "ENDSTOP_INTERRUPTS_FEATURE is not supported in this simulation environment."
|
||||
|
||||
void setup_endstop_interrupts() {
|
||||
// This function is a stub for setting up endstop interrupts.
|
||||
// Since this is a simulation environment, actual hardware interrupts
|
||||
// are not applicable. Add any necessary simulation-specific logic here.
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
|
||||
* Copyright (c) 2009 Michael Margolis. All right reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
|
||||
* Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
|
||||
*
|
||||
* The only modification was to update/delete macros to match the LPC176x.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Macros
|
||||
//values in microseconds
|
||||
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
|
||||
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
|
||||
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
|
||||
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
|
||||
|
||||
#define MAX_SERVOS 4
|
||||
|
||||
#define INVALID_SERVO 255 // flag indicating an invalid servo index
|
||||
|
||||
// Types
|
||||
|
||||
typedef struct {
|
||||
uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin)
|
||||
uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false
|
||||
} ServoPin_t;
|
||||
|
||||
typedef struct {
|
||||
ServoPin_t Pin;
|
||||
unsigned int pulse_width; // pulse width in microseconds
|
||||
} ServoInfo_t;
|
||||
|
||||
// Global variables
|
||||
|
||||
extern uint8_t ServoCount;
|
||||
extern ServoInfo_t servo_info[MAX_SERVOS];
|
||||
@@ -77,7 +77,7 @@ void MarlinHAL::init() {
|
||||
|
||||
HAL_timer_init();
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER) && USBD_USE_CDC
|
||||
#if ALL(EMERGENCY_PARSER, USBD_USE_CDC)
|
||||
USB_Hook_init();
|
||||
#endif
|
||||
|
||||
@@ -87,7 +87,7 @@ void MarlinHAL::init() {
|
||||
|
||||
#if PIN_EXISTS(USB_CONNECT)
|
||||
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
|
||||
delay_ms(1000); // Give OS time to notice
|
||||
delay_ms(1000); // Give OS time to notice
|
||||
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -29,16 +29,16 @@
|
||||
|
||||
#include "arduino_extras.h"
|
||||
#include "../../core/macros.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "fastio.h"
|
||||
//#include "Servo.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
#include "msc_sd.h"
|
||||
#endif
|
||||
|
||||
//
|
||||
// Serial Ports
|
||||
@@ -139,10 +139,10 @@ public:
|
||||
static void isr_on() { __enable_irq(); }
|
||||
static void isr_off() { __disable_irq(); }
|
||||
|
||||
static void delay_ms(const int ms) { ::delay(ms); }
|
||||
static void delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
// Tasks, called from idle()
|
||||
static void idletask() {}
|
||||
static void idletask() { TERN_(HAS_SD_HOST_DRIVE, tuh_task()); }
|
||||
|
||||
// Reset
|
||||
static uint8_t get_reset_source();
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "../shared/HAL_MinSerial.h"
|
||||
|
||||
|
||||
static void TXBegin() {
|
||||
#if !WITHIN(SERIAL_PORT, -1, 2)
|
||||
#warning "Using POSTMORTEM_DEBUGGING requires a physical U(S)ART hardware in case of severe error."
|
||||
|
||||
+3
-3
@@ -19,15 +19,15 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef __PLAT_RP2040__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
// NOTE: The Bigtreetech SKR Pico has an onboard W25Q16 flash module
|
||||
|
||||
+4
-4
@@ -19,11 +19,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef __PLAT_RP2040__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if ALL(SDSUPPORT, USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
|
||||
#if HAS_MEDIA && DISABLED(NO_SD_HOST_DRIVE)
|
||||
#define HAS_SD_HOST_DRIVE 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -27,109 +27,77 @@
|
||||
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "msc_sd.h"
|
||||
#include "usbd_core.h"
|
||||
|
||||
#include "../../sd/cardreader.h"
|
||||
|
||||
#include <USB.h>
|
||||
#include <USBMscHandler.h>
|
||||
#include <tusb.h> // TinyUSB device stack
|
||||
|
||||
#define BLOCK_SIZE 512
|
||||
#define PRODUCT_ID 0x29
|
||||
#define SD_MULTIBLOCK_RETRY_CNT 1
|
||||
|
||||
class Sd2CardUSBMscHandler : public USBMscHandler {
|
||||
public:
|
||||
DiskIODriver* diskIODriver() {
|
||||
#if HAS_MULTI_VOLUME
|
||||
#if SHARED_VOLUME_IS(SD_ONBOARD)
|
||||
return &card.media_driver_sdcard;
|
||||
#elif SHARED_VOLUME_IS(USB_FLASH_DRIVE)
|
||||
return &card.media_driver_usbFlash;
|
||||
#endif
|
||||
#else
|
||||
return card.diskIODriver();
|
||||
DiskIODriver* diskIODriver() {
|
||||
#if HAS_MULTI_VOLUME
|
||||
#if SHARED_VOLUME_IS(SD_ONBOARD)
|
||||
return &card.media_driver_sdcard;
|
||||
#elif SHARED_VOLUME_IS(USB_FLASH_DRIVE)
|
||||
return &card.media_driver_usbFlash;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
return card.diskIODriver();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GetCapacity(uint32_t *pBlockNum, uint16_t *pBlockSize) {
|
||||
*pBlockNum = diskIODriver()->cardSize();
|
||||
*pBlockSize = BLOCK_SIZE;
|
||||
return true;
|
||||
}
|
||||
/** Callbacks used by TinyUSB MSC **/
|
||||
|
||||
bool Write(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
|
||||
auto sd2card = diskIODriver();
|
||||
// single block
|
||||
if (blkLen == 1) {
|
||||
watchdog_refresh();
|
||||
sd2card->writeBlock(blkAddr, pBuf);
|
||||
return true;
|
||||
extern "C" {
|
||||
|
||||
bool tud_msc_ready_cb(uint8_t lun) {
|
||||
return diskIODriver()->isReady();
|
||||
}
|
||||
|
||||
int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, void* buffer, uint32_t bufsize) {
|
||||
const uint32_t blocks = bufsize / BLOCK_SIZE;
|
||||
for (uint16_t rcount = SD_MULTIBLOCK_RETRY_CNT; rcount--; ) {
|
||||
if (diskIODriver()->readBlocks(lba, (uint8_t*)buffer, blocks))
|
||||
return bufsize; // Success
|
||||
}
|
||||
return -1; // Failure after retries
|
||||
}
|
||||
|
||||
int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint8_t const* buffer, uint32_t bufsize) {
|
||||
const uint32_t blocks = bufsize / BLOCK_SIZE;
|
||||
for (uint16_t rcount = SD_MULTIBLOCK_RETRY_CNT; rcount--; ) {
|
||||
if (diskIODriver()->writeBlocks(lba, buffer, blocks))
|
||||
return bufsize; // Success
|
||||
}
|
||||
return -1; // Failure after retries
|
||||
}
|
||||
|
||||
void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) {
|
||||
memcpy(vendor_id, "MARLIN ", 8);
|
||||
memcpy(product_id, "Product ", 16);
|
||||
memcpy(product_rev, "0.01", 4);
|
||||
}
|
||||
|
||||
void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size) {
|
||||
*block_count = diskIODriver()->cardSize();
|
||||
*block_size = BLOCK_SIZE;
|
||||
}
|
||||
|
||||
void tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) {
|
||||
if (load_eject) {
|
||||
if (start) {
|
||||
// Handle media load
|
||||
} else {
|
||||
// Handle media eject
|
||||
}
|
||||
|
||||
// multi block optimization
|
||||
sd2card->writeStart(blkAddr, blkLen);
|
||||
while (blkLen--) {
|
||||
watchdog_refresh();
|
||||
sd2card->writeData(pBuf);
|
||||
pBuf += BLOCK_SIZE;
|
||||
}
|
||||
sd2card->writeStop();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Read(uint8_t *pBuf, uint32_t blkAddr, uint16_t blkLen) {
|
||||
auto sd2card = diskIODriver();
|
||||
// single block
|
||||
if (blkLen == 1) {
|
||||
watchdog_refresh();
|
||||
sd2card->readBlock(blkAddr, pBuf);
|
||||
return true;
|
||||
}
|
||||
|
||||
// multi block optimization
|
||||
sd2card->readStart(blkAddr);
|
||||
while (blkLen--) {
|
||||
watchdog_refresh();
|
||||
sd2card->readData(pBuf);
|
||||
pBuf += BLOCK_SIZE;
|
||||
}
|
||||
sd2card->readStop();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsReady() {
|
||||
return diskIODriver()->isReady();
|
||||
}
|
||||
};
|
||||
|
||||
Sd2CardUSBMscHandler usbMscHandler;
|
||||
|
||||
/* USB Mass storage Standard Inquiry Data */
|
||||
uint8_t Marlin_STORAGE_Inquirydata[] = { /* 36 */
|
||||
/* LUN 0 */
|
||||
0x00,
|
||||
0x80,
|
||||
0x02,
|
||||
0x02,
|
||||
(STANDARD_INQUIRY_DATA_LEN - 5),
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
'M', 'A', 'R', 'L', 'I', 'N', ' ', ' ', /* Manufacturer : 8 bytes */
|
||||
'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */
|
||||
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
|
||||
'0', '.', '0', '1', /* Version : 4 Bytes */
|
||||
};
|
||||
|
||||
USBMscHandler *pSingleMscHandler = &usbMscHandler;
|
||||
} // extern "C"
|
||||
|
||||
void MSC_SD_init() {
|
||||
USBDevice.end();
|
||||
delay(200);
|
||||
USBDevice.registerMscHandlers(1, &pSingleMscHandler, Marlin_STORAGE_Inquirydata);
|
||||
USBDevice.begin();
|
||||
tusb_init();
|
||||
// Add USB reinitialization logic if needed
|
||||
}
|
||||
|
||||
#endif // HAS_SD_HOST_DRIVE
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* SAMD21 HAL developed by Bart Meijer (brupje)
|
||||
* Based on SAMD51 HAL by Giuliano Zaro (AKA GMagician)
|
||||
*/
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(QSPI_EEPROM)
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
#ifdef __SAMD21__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/* reserve flash memory */
|
||||
static const uint8_t flashdata[TOTAL_FLASH_SIZE] __attribute__((__aligned__(256))) { }; \
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE - eeprom_exclude_size; }
|
||||
|
||||
+2
-2
@@ -26,13 +26,13 @@
|
||||
*/
|
||||
#ifdef __SAMD21__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(QSPI_EEPROM)
|
||||
|
||||
#error "QSPI_EEPROM emulation Not implemented on SAMD21"
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#include "QSPIFlash.h"
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
#ifdef __SAMD21__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(QSPI_EEPROM)
|
||||
|
||||
+2
-2
@@ -25,11 +25,11 @@
|
||||
*/
|
||||
#ifdef __SAMD51__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#define NVMCTRL_CMD(c) do{ \
|
||||
SYNC(!NVMCTRL->STATUS.bit.READY); \
|
||||
+2
-2
@@ -25,11 +25,11 @@
|
||||
*/
|
||||
#ifdef __SAMD51__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(QSPI_EEPROM)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#include "QSPIFlash.h"
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
#ifdef __SAMD51__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||
@@ -43,8 +43,8 @@
|
||||
#endif
|
||||
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
#include "msc_sd.h"
|
||||
#include "usbd_cdc_if.h"
|
||||
#include "sd/msc_sd.h"
|
||||
#include <usbd_cdc_if.h>
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
@@ -87,7 +87,7 @@ void MarlinHAL::init() {
|
||||
|
||||
SetTimerInterruptPriorities();
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC)
|
||||
#if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC)
|
||||
USB_Hook_init();
|
||||
#endif
|
||||
|
||||
@@ -97,7 +97,7 @@ void MarlinHAL::init() {
|
||||
|
||||
#if PIN_EXISTS(USB_CONNECT)
|
||||
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
|
||||
delay(1000); // Give OS time to notice
|
||||
delay_ms(1000); // Give OS time to notice
|
||||
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -23,18 +23,14 @@
|
||||
|
||||
#define CPU_32_BIT
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
#include "temp_soc.h"
|
||||
#include "fastio.h"
|
||||
#include "Servo.h"
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//
|
||||
// Default graphical display delays
|
||||
//
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
//
|
||||
// PersistentStore
|
||||
+5
-5
@@ -19,15 +19,15 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
// Better: "utility/stm32_eeprom.h", but only after updating stm32duino to 2.0.0
|
||||
// Use EEPROM.h for compatibility, for now.
|
||||
@@ -50,10 +50,10 @@
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
#include "stm32_def.h"
|
||||
#include <stm32_def.h>
|
||||
|
||||
#define DEBUG_OUT ENABLED(EEPROM_CHITCHAT)
|
||||
#include "../../core/debug_out.h"
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||
+4
-4
@@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../../libs/BL24CXX.h"
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../../../libs/BL24CXX.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
|
||||
void eeprom_init() { BL24CXX::init(); }
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
* Implementation of EEPROM settings in SD Card
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../sd/cardreader.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
#include "../../../sd/cardreader.h"
|
||||
|
||||
#define EEPROM_FILENAME "eeprom.dat"
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SRAM_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||
+4
-4
@@ -19,11 +19,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE size_t(E2END + 1)
|
||||
@@ -20,20 +20,19 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../../../sd/cardreader.h"
|
||||
|
||||
#include "msc_sd.h"
|
||||
#include "usbd_core.h"
|
||||
|
||||
#include "../../sd/cardreader.h"
|
||||
|
||||
#include <usbd_core.h>
|
||||
#include <USB.h>
|
||||
#include <USBMscHandler.h>
|
||||
|
||||
@@ -49,6 +48,7 @@
|
||||
class Sd2CardUSBMscHandler : public USBMscHandler {
|
||||
public:
|
||||
DiskIODriver* diskIODriver() {
|
||||
// TODO: Explore a variable shared volume, or auto share the un-mounted volume(s)
|
||||
#if HAS_MULTI_VOLUME
|
||||
#if SHARED_VOLUME_IS(SD_ONBOARD)
|
||||
return &card.media_driver_sdcard;
|
||||
@@ -20,18 +20,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../platforms.h"
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ALL(USE_OTG_USB_HOST, USBHOST)
|
||||
|
||||
#include "usb_host.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "usbh_core.h"
|
||||
#include "usbh_msc.h"
|
||||
#include <usbh_core.h>
|
||||
#include <usbh_msc.h>
|
||||
|
||||
USBH_HandleTypeDef hUsbHost;
|
||||
USBHost usb;
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER) && (USBD_USE_CDC || USBD_USE_CDC_MSC)
|
||||
#if ENABLED(EMERGENCY_PARSER) && ANY(USBD_USE_CDC, USBD_USE_CDC_MSC)
|
||||
|
||||
#include "usb_serial.h"
|
||||
#include "../../feature/e_parser.h"
|
||||
@@ -56,5 +56,5 @@ void USB_Hook_init() {
|
||||
USBD_CDC_fops.Receive = USBD_CDC_Receive_hook;
|
||||
}
|
||||
|
||||
#endif // EMERGENCY_PARSER && USBD_USE_CDC
|
||||
#endif // EMERGENCY_PARSER && (USBD_USE_CDC || USBD_USE_CDC_MSC)
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -65,7 +65,8 @@ uint16_t adc_results[ADC_COUNT];
|
||||
emergency_parser.update(MSerial0.emergency_state, buf[i + total - len]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // SERIAL_USB && !HAS_SD_HOST_DRIVE
|
||||
|
||||
// ------------------------
|
||||
// Watchdog Timer
|
||||
@@ -252,7 +253,7 @@ void MarlinHAL::init() {
|
||||
#endif
|
||||
#if PIN_EXISTS(USB_CONNECT)
|
||||
OUT_WRITE(USB_CONNECT_PIN, !USB_CONNECT_INVERTING); // USB clear connection
|
||||
delay(1000); // Give OS time to notice
|
||||
delay_ms(1000); // Give OS time to notice
|
||||
WRITE(USB_CONNECT_PIN, USB_CONNECT_INVERTING);
|
||||
#endif
|
||||
TERN_(POSTMORTEM_DEBUGGING, install_min_serial()); // Install the minimal serial handler
|
||||
@@ -264,7 +265,7 @@ void MarlinHAL::idletask() {
|
||||
/**
|
||||
* When Marlin is using the SD card it should be locked to prevent it being
|
||||
* accessed from a PC over USB.
|
||||
* Other HALs use (IS_SD_PRINTING() || IS_SD_FILE_OPEN()) to check for access
|
||||
* Other HALs use (card.isStillPrinting() || card.isFileOpen()) to check for access
|
||||
* but this won't reliably detect other file operations. To be safe we just lock
|
||||
* the drive whenever Marlin has it mounted. LCDs should include an Unmount
|
||||
* command so drives can be released as needed.
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
#include "msc_sd.h"
|
||||
#include "sd/msc_sd.h"
|
||||
#endif
|
||||
|
||||
// ------------------------
|
||||
|
||||
+3
-3
@@ -26,12 +26,12 @@
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
//
|
||||
// PersistentStore
|
||||
+2
-2
@@ -28,11 +28,11 @@
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#include <flash_stm32.h>
|
||||
#include <EEPROM.h>
|
||||
+3
-3
@@ -27,12 +27,12 @@
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../../libs/BL24CXX.h"
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../../../libs/BL24CXX.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
|
||||
void eeprom_init() { BL24CXX::init(); }
|
||||
|
||||
+3
-3
@@ -27,12 +27,12 @@
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../sd/cardreader.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
#include "../../../sd/cardreader.h"
|
||||
|
||||
#define EEPROM_FILENAME "eeprom.dat"
|
||||
|
||||
+3
-3
@@ -26,12 +26,12 @@
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../shared/eeprom_if.h"
|
||||
#include "../../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||
@@ -22,20 +22,21 @@
|
||||
*/
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if HAS_SD_HOST_DRIVE
|
||||
|
||||
#include "msc_sd.h"
|
||||
#include "SPI.h"
|
||||
#include "usb_reg_map.h"
|
||||
#include "../SPI.h"
|
||||
|
||||
#include <usb_reg_map.h>
|
||||
|
||||
#define PRODUCT_ID 0x29
|
||||
|
||||
USBMassStorage MarlinMSC;
|
||||
Serial1Class<USBCompositeSerial> MarlinCompositeSerial(true);
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if SD_CONNECTION_IS(ONBOARD)
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
#include <USBComposite.h>
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
#include "../../core/serial_hook.h"
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../../../core/serial_hook.h"
|
||||
|
||||
extern USBMassStorage MarlinMSC;
|
||||
extern Serial1Class<USBCompositeSerial> MarlinCompositeSerial;
|
||||
@@ -13,13 +13,13 @@
|
||||
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if SD_CONNECTION_IS(ONBOARD)
|
||||
|
||||
#include "onboard_sd.h"
|
||||
#include "SPI.h"
|
||||
#include "fastio.h"
|
||||
#include "../SPI.h"
|
||||
#include "../fastio.h"
|
||||
|
||||
#ifndef ONBOARD_SPI_DEVICE
|
||||
#define ONBOARD_SPI_DEVICE SPI_DEVICE
|
||||
@@ -19,11 +19,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_STM32F1
|
||||
#ifdef __STM32F1__
|
||||
|
||||
#include <libmaple/stm32.h>
|
||||
|
||||
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
|
||||
#include "../../../inc/MarlinConfig.h" // Allow pins/pins.h to set density
|
||||
|
||||
#if ANY(STM32_HIGH_DENSITY, STM32_XL_DENSITY)
|
||||
|
||||
@@ -308,4 +308,4 @@ bool SDIO_GetCmdResp7() {
|
||||
}
|
||||
|
||||
#endif // STM32_HIGH_DENSITY || STM32_XL_DENSITY
|
||||
#endif // ARDUINO_ARCH_STM32F1
|
||||
#endif // __STM32F1__
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to override SDIO clock / retries
|
||||
#include "../../../inc/MarlinConfig.h" // Allow pins/pins.h to override SDIO clock / retries
|
||||
|
||||
#include <libmaple/sdio.h>
|
||||
#include <libmaple/dma.h>
|
||||
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Math helper functions for 32 bit CPUs
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
* write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
|
||||
* writeMicroseconds() - Sets the servo pulse width in microseconds
|
||||
* read() - Gets the last written servo pulse width as an angle between 0 and 180.
|
||||
* readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
|
||||
* readMicroseconds() - Gets the last written servo pulse width in microseconds.
|
||||
* attached() - Returns true if there is a servo attached.
|
||||
* detach() - Stops an attached servos from pulsing its i/o pin.
|
||||
* move(angle) - Sequence of attach(0), write(angle),
|
||||
@@ -86,6 +86,8 @@
|
||||
#include "../ESP32/Servo.h"
|
||||
#elif defined(__PLAT_RP2040__)
|
||||
#include "../RP2040/Servo.h"
|
||||
#elif defined(__PLAT_NATIVE_SIM__)
|
||||
#include "../NATIVE_SIM/Servo.h"
|
||||
#else
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -100,22 +102,22 @@
|
||||
class Servo {
|
||||
public:
|
||||
Servo();
|
||||
int8_t attach(const int pin); // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail)
|
||||
int8_t attach(const int pin, const int min, const int max); // as above but also sets min and max values for writes.
|
||||
int8_t attach(const int pin); // Attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail)
|
||||
int8_t attach(const int pin, const int min, const int max); // As above but also set min and max values for writes.
|
||||
void detach();
|
||||
void write(int value); // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
|
||||
void writeMicroseconds(int value); // write pulse width in microseconds
|
||||
void move(const int value); // attach the servo, then move to value
|
||||
// if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
|
||||
// if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach
|
||||
int read(); // returns current pulse width as an angle between 0 and 180 degrees
|
||||
int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
|
||||
bool attached(); // return true if this servo is attached, otherwise false
|
||||
void write(int value); // If value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
|
||||
void writeMicroseconds(int value); // Write pulse width in microseconds
|
||||
void move(const int value); // Attach the servo, then move to value
|
||||
// If value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
|
||||
// If DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach
|
||||
int read(); // Return current pulse width as an angle between 0 and 180 degrees
|
||||
int readMicroseconds(); // Return current pulse width in microseconds for this servo
|
||||
bool attached(); // Return true if this servo is attached, otherwise false
|
||||
|
||||
private:
|
||||
uint8_t servoIndex; // index into the channel data for this servo
|
||||
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH
|
||||
int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH
|
||||
uint8_t servoIndex; // Index into the channel data for this servo
|
||||
int8_t min; // Minimum is this value times 4 added to MIN_PULSE_WIDTH
|
||||
int8_t max; // Maximum is this value times 4 added to MAX_PULSE_WIDTH
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -269,6 +269,10 @@
|
||||
#include "feature/rs485.h"
|
||||
#endif
|
||||
|
||||
#if !HAS_MEDIA
|
||||
CardReader card; // Stub instance with "no media" methods
|
||||
#endif
|
||||
|
||||
PGMSTR(M112_KILL_STR, "M112 Shutdown");
|
||||
|
||||
#if ENABLED(CONFIGURABLE_MACHINE_NAME)
|
||||
@@ -339,7 +343,7 @@ bool printer_busy() {
|
||||
/**
|
||||
* A Print Job exists when the timer is running or SD is printing
|
||||
*/
|
||||
bool printJobOngoing() { return print_job_timer.isRunning() || IS_SD_PRINTING(); }
|
||||
bool printJobOngoing() { return print_job_timer.isRunning() || card.isStillPrinting(); }
|
||||
|
||||
/**
|
||||
* Printing is active when a job is underway but not paused
|
||||
@@ -350,7 +354,7 @@ bool printingIsActive() { return !did_pause_print && printJobOngoing(); }
|
||||
* Printing is paused according to SD or host indicators
|
||||
*/
|
||||
bool printingIsPaused() {
|
||||
return did_pause_print || print_job_timer.isPaused() || IS_SD_PAUSED();
|
||||
return did_pause_print || print_job_timer.isPaused() || card.isPaused();
|
||||
}
|
||||
|
||||
void startOrResumeJob() {
|
||||
@@ -509,7 +513,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
// Handle a standalone HOME button
|
||||
constexpr millis_t HOME_DEBOUNCE_DELAY = 1000UL;
|
||||
static millis_t next_home_key_ms; // = 0
|
||||
if (!IS_SD_PRINTING() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed
|
||||
if (!card.isStillPrinting() && !READ(HOME_PIN)) { // HOME_PIN goes LOW when pressed
|
||||
if (ELAPSED(ms, next_home_key_ms)) {
|
||||
next_home_key_ms = ms + HOME_DEBOUNCE_DELAY;
|
||||
LCD_MESSAGE(MSG_AUTO_HOME);
|
||||
@@ -804,7 +808,7 @@ void idle(const bool no_stepper_sleep/*=false*/) {
|
||||
|
||||
// Handle Power-Loss Recovery
|
||||
#if ENABLED(POWER_LOSS_RECOVERY) && PIN_EXISTS(POWER_LOSS)
|
||||
if (IS_SD_PRINTING()) recovery.outage();
|
||||
if (card.isStillPrinting()) recovery.outage();
|
||||
#endif
|
||||
|
||||
// Run StallGuard endstop checks
|
||||
@@ -816,9 +820,6 @@ void idle(const bool no_stepper_sleep/*=false*/) {
|
||||
// Handle SD Card insert / remove
|
||||
TERN_(HAS_MEDIA, card.manage_media());
|
||||
|
||||
// Handle USB Flash Drive insert / remove
|
||||
TERN_(HAS_USB_FLASH_DRIVE, card.diskIODriver()->idle());
|
||||
|
||||
// Announce Host Keepalive state (if any)
|
||||
TERN_(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive());
|
||||
|
||||
@@ -1348,8 +1349,11 @@ void setup() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_MEDIA && ANY(SDCARD_EEPROM_EMULATION, POWER_LOSS_RECOVERY)
|
||||
SETUP_RUN(card.mount()); // Mount media with settings before first_load
|
||||
#if HAS_MEDIA
|
||||
SETUP_RUN(card.init()); // Prepare for media usage
|
||||
#if ANY(SDCARD_EEPROM_EMULATION, POWER_LOSS_RECOVERY)
|
||||
SETUP_RUN(card.mount()); // Mount media with settings before first_load
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Prepare some LCDs to display early
|
||||
|
||||
@@ -134,19 +134,19 @@ private:
|
||||
public:
|
||||
|
||||
static void idle() {
|
||||
// If a transfer is interrupted and a file is left open, abort it after TIMEOUT ms
|
||||
// If a transfer is interrupted and a file is left open, abort it after 'idle_period' ms
|
||||
const millis_t ms = millis();
|
||||
if (transfer_active && ELAPSED(ms, idle_timeout)) {
|
||||
idle_timeout = ms + IDLE_PERIOD;
|
||||
idle_timeout = ms + idle_period;
|
||||
if (ELAPSED(ms, transfer_timeout)) transfer_abort();
|
||||
}
|
||||
}
|
||||
|
||||
static void process(uint8_t packet_type, char *buffer, const uint16_t length) {
|
||||
transfer_timeout = millis() + TIMEOUT;
|
||||
transfer_timeout = millis() + timeout;
|
||||
switch (static_cast<FileTransfer>(packet_type)) {
|
||||
case FileTransfer::QUERY:
|
||||
SERIAL_ECHO(F("PFT:version:"), VERSION_MAJOR, C('.'), VERSION_MINOR, C('.'), VERSION_PATCH);
|
||||
SERIAL_ECHO(F("PFT:version:"), version_major, C('.'), version_minor, C('.'), version_patch);
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
SERIAL_ECHOLN(F(":compression:heatshrink,"), HEATSHRINK_STATIC_WINDOW_BITS, C(','), HEATSHRINK_STATIC_LOOKAHEAD_BITS);
|
||||
#else
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static const uint16_t VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0, TIMEOUT = 10000, IDLE_PERIOD = 1000;
|
||||
static const uint16_t version_major = 0, version_minor = 1, version_patch = 0, timeout = 10000, idle_period = 1000;
|
||||
};
|
||||
|
||||
class BinaryStream {
|
||||
@@ -209,7 +209,7 @@ public:
|
||||
struct Packet { // 10 byte protocol overhead, ascii with checksum and line number has a minimum of 7 increasing with line
|
||||
|
||||
union Header {
|
||||
static constexpr uint16_t HEADER_TOKEN = 0xB5AD;
|
||||
static constexpr uint16_t header_token = 0xB5AD;
|
||||
struct [[gnu::packed]] {
|
||||
uint16_t token; // packet start token
|
||||
uint8_t sync; // stream sync, resend id and packet loss detection
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
bytes_received = 0;
|
||||
checksum = 0;
|
||||
header_checksum = 0;
|
||||
timeout = millis() + PACKET_MAX_WAIT;
|
||||
timeout = millis() + packet_max_wait;
|
||||
buffer = nullptr;
|
||||
}
|
||||
} packet{};
|
||||
@@ -272,14 +272,14 @@ public:
|
||||
}
|
||||
if (!bs_serial_data_available(card.transfer_port_index)) return false;
|
||||
data = bs_read_serial(card.transfer_port_index);
|
||||
packet.timeout = millis() + PACKET_MAX_WAIT;
|
||||
packet.timeout = millis() + packet_max_wait;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<const size_t buffer_size>
|
||||
void receive(char (&buffer)[buffer_size]) {
|
||||
uint8_t data = 0;
|
||||
millis_t transfer_window = millis() + RX_TIMESLICE;
|
||||
millis_t transfer_window = millis() + rx_timeslice;
|
||||
|
||||
#if HAS_MEDIA
|
||||
PORT_REDIRECT(SERIAL_PORTMASK(card.transfer_port_index));
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
case StreamState::PACKET_WAIT:
|
||||
if (!stream_read(data)) { idle(); return; } // no active packet so don't wait
|
||||
packet.header.data[1] = data;
|
||||
if (packet.header.token == packet.header.HEADER_TOKEN) {
|
||||
if (packet.header.token == packet.header.header_token) {
|
||||
packet.bytes_received = 2;
|
||||
stream_state = StreamState::PACKET_HEADER;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
if (packet.header.checksum == packet.header_checksum) {
|
||||
// The SYNC control packet is a special case in that it doesn't require the stream sync to be correct
|
||||
if (static_cast<Protocol>(packet.header.protocol()) == Protocol::CONTROL && static_cast<ProtocolControl>(packet.header.type()) == ProtocolControl::SYNC) {
|
||||
SERIAL_ECHOLN(F("ss"), sync, C(','), buffer_size, C(','), VERSION_MAJOR, C('.'), VERSION_MINOR, C('.'), VERSION_PATCH);
|
||||
SERIAL_ECHOLN(F("ss"), sync, C(','), buffer_size, C(','), version_major, C('.'), version_minor, C('.'), version_patch);
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
break;
|
||||
}
|
||||
@@ -398,7 +398,7 @@ public:
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
break;
|
||||
case StreamState::PACKET_RESEND:
|
||||
if (packet_retries < MAX_RETRIES || MAX_RETRIES == 0) {
|
||||
if (packet_retries < max_retries || max_retries == 0) {
|
||||
packet_retries++;
|
||||
stream_state = StreamState::PACKET_RESET;
|
||||
SERIAL_ECHO_MSG("Resend request ", packet_retries);
|
||||
@@ -446,7 +446,7 @@ public:
|
||||
SDFileTransferProtocol::idle();
|
||||
}
|
||||
|
||||
static const uint16_t PACKET_MAX_WAIT = 500, RX_TIMESLICE = 20, MAX_RETRIES = 0, VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0;
|
||||
static const uint16_t packet_max_wait = 500, rx_timeslice = 20, max_retries = 0, version_major = 0, version_minor = 1, version_patch = 0;
|
||||
uint8_t packet_retries, sync;
|
||||
uint16_t buffer_next_index;
|
||||
uint32_t bytes_received;
|
||||
|
||||
@@ -48,7 +48,7 @@ bool BLTouch::command(const BLTCommand cmd, const millis_t &ms) {
|
||||
// The previous write should've already delayed to detect the alarm.
|
||||
if (cmd != current) {
|
||||
servo[Z_PROBE_SERVO_NR].move(cmd);
|
||||
safe_delay(_MAX(ms, (uint32_t)BLTOUCH_DELAY)); // BLTOUCH_DELAY is also the *minimum* delay
|
||||
safe_delay(_MAX(ms, uint32_t(BLTOUCH_DELAY))); // BLTOUCH_DELAY is also the *minimum* delay
|
||||
}
|
||||
return triggered();
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ namespace MMU3 {
|
||||
if (slot != extruder) {
|
||||
if (
|
||||
//findaDetectsFilament()
|
||||
//!IS_SD_PRINTING() && !usb_timer.running()
|
||||
//!card.isStillPrinting() && !usb_timer.running()
|
||||
!marlin_printingIsActive()
|
||||
) {
|
||||
// If Tcodes are used manually through the serial
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user