diff options
author | Christian Hammacher <bmasterc@gmail.com> | 2022-05-02 18:10:24 +0300 |
---|---|---|
committer | Christian Hammacher <bmasterc@gmail.com> | 2022-05-02 18:10:24 +0300 |
commit | 866309dc359ef71ee1d862d045206990f35eda94 (patch) | |
tree | e80cf390ce6820cb4571e872e9742e697b002ff9 /src | |
parent | d03ec3c3f1b59b100e9cabd60568c420f610b2f7 (diff) | |
parent | c946e3c7acca09fd1324eec6b423fce93e558e9c (diff) |
Merge remote-tracking branch 'origin/3.4-dev' into v3-chrishamm
Diffstat (limited to 'src')
32 files changed, 494 insertions, 214 deletions
diff --git a/src/Comms/FirmwareUpdater.cpp b/src/Comms/FirmwareUpdater.cpp index 84597db2..4cb44e73 100644 --- a/src/Comms/FirmwareUpdater.cpp +++ b/src/Comms/FirmwareUpdater.cpp @@ -33,7 +33,7 @@ namespace FirmwareUpdater const size_t serialChannel, const StringRef& filenameRef) noexcept { -#if HAS_WIFI_NETWORKING +#if HAS_WIFI_NETWORKING && (HAS_MASS_STORAGE || HAS_EMBEDDED_FILES) if (moduleMap.IsBitSet(WifiExternalFirmwareModule) || moduleMap.IsBitSet(WifiFirmwareModule)) { GCodeResult result; @@ -58,7 +58,7 @@ namespace FirmwareUpdater } } #endif -#if HAS_AUX_DEVICES +#if SUPPORT_PANELDUE_FLASH && (HAS_MASS_STORAGE || HAS_EMBEDDED_FILES) if (moduleMap.IsBitSet(PanelDueFirmwareModule)) { if (!reprap.GetPlatform().IsAuxEnabled(serialChannel-1) || reprap.GetPlatform().IsAuxRaw(serialChannel-1)) @@ -80,7 +80,7 @@ namespace FirmwareUpdater bool IsReady() noexcept { -#if HAS_WIFI_NETWORKING +#if HAS_WIFI_NETWORKING && (HAS_MASS_STORAGE || HAS_EMBEDDED_FILES) WifiFirmwareUploader * const uploader = reprap.GetNetwork().GetWifiUploader(); if (uploader != nullptr && !uploader->IsReady()) { @@ -99,7 +99,7 @@ namespace FirmwareUpdater void UpdateModule(unsigned int module, const size_t serialChannel, const StringRef& filenameRef) noexcept { -#if HAS_WIFI_NETWORKING || SUPPORT_PANELDUE_FLASH +#if (HAS_WIFI_NETWORKING || SUPPORT_PANELDUE_FLASH) && (HAS_MASS_STORAGE || HAS_EMBEDDED_FILES) switch(module) { # if HAS_WIFI_NETWORKING diff --git a/src/Config/Pins.h b/src/Config/Pins.h index 9cef26ef..90703344 100644 --- a/src/Config/Pins.h +++ b/src/Config/Pins.h @@ -23,9 +23,9 @@ # elif defined(DUET3MINI_V04) # define DUET3MINI 1 # define PLATFORM Duet3Mini -# elif defined(DUET3MINI4) +# elif defined(FMDC_V02) # define DUET3MINI 1 -# define PLATFORM Duet3Mini4 +# define PLATFORM FMDC # elif defined(__LPC17xx__) # define PLATFORM LPC # else diff --git a/src/Config/Pins_Duet3Mini.h b/src/Config/Pins_Duet3Mini.h index 185ea3e0..188c7f79 100644 --- a/src/Config/Pins_Duet3Mini.h +++ b/src/Config/Pins_Duet3Mini.h @@ -211,7 +211,7 @@ constexpr Pin SdWriteProtectPins[NumSdCards] = { NoPin, NoPin }; constexpr Pin SdSpiCSPins[NumSdCards - 1] = { PortCPin(14) }; constexpr Pin SdMciPins[] = { PortAPin(20), PortAPin(21), PortBPin(18), PortBPin(19), PortBPin(20), PortBPin(21) }; constexpr GpioPinFunction SdMciPinsFunction = GpioPinFunction::I; -Sdhc * const SdDevice = SDHC1; +Sdhc * const SdhcDevice = SDHC1; constexpr IRQn_Type SdhcIRQn = SDHC1_IRQn; constexpr uint32_t ExpectedSdCardSpeed = 15000000; diff --git a/src/Config/Pins_Duet3Mini4.h b/src/Config/Pins_FMDC.h index 6bf76fa3..bcaa82e3 100644 --- a/src/Config/Pins_Duet3Mini4.h +++ b/src/Config/Pins_FMDC.h @@ -10,11 +10,11 @@ #include <PinDescription.h> -#define DEFAULT_BOARD_TYPE BoardType::Duet3Mini4 +#define DEFAULT_BOARD_TYPE BoardType::FMDC -#define BOARD_SHORT_NAME "Mini4" -#define BOARD_NAME "Duet 3 Mini 4" -#define FIRMWARE_NAME "RepRapFirmware for Duet 3 Mini 4" +#define BOARD_SHORT_NAME "FMDC" +#define BOARD_NAME "FMDC" +#define FIRMWARE_NAME "RepRapFirmware for FMDC" #define IAP_FIRMWARE_FILE "Duet3Firmware_" BOARD_SHORT_NAME ".uf2" #define IAP_UPDATE_FILE "Duet3_SDiap32_" BOARD_SHORT_NAME ".bin" @@ -51,6 +51,7 @@ constexpr uint32_t IAP_IMAGE_START = 0x20028000; #define SUPPORT_DHT_SENSOR 1 // set nonzero to support DHT temperature/humidity sensors (requires RTOS) #define SUPPORT_WORKPLACE_COORDINATES 1 // set nonzero to support G10 L2 and G53..59 #define SUPPORT_12864_LCD 0 // set nonzero to support 12864 LCD and rotary encoder +#define SUPPORT_TFTM0356_6_LCD 1 #define SUPPORT_ACCELEROMETERS 1 #define SUPPORT_OBJECT_MODEL 1 #define SUPPORT_FTP 0 @@ -90,27 +91,25 @@ constexpr size_t NumThermistorInputs = 2; constexpr size_t NumTmcDriversSenseChannels = 1; constexpr size_t MinAxes = 3; // The minimum and default number of axes -constexpr size_t MaxAxes = 10; // The maximum number of movement axes in the machine -constexpr size_t MaxDriversPerAxis = 4; // The maximum number of stepper drivers assigned to one axis +constexpr size_t MaxAxes = 4; // The maximum number of movement axes in the machine +constexpr size_t MaxDriversPerAxis = 2; // The maximum number of stepper drivers assigned to one axis -constexpr size_t MaxExtruders = 8; // The maximum number of extruders -constexpr size_t MaxAxesPlusExtruders = 12; +constexpr size_t MaxExtruders = 2; // The maximum number of extruders +constexpr size_t MaxAxesPlusExtruders = 6; constexpr size_t MaxHeatersPerTool = 2; -constexpr size_t MaxExtrudersPerTool = 8; +constexpr size_t MaxExtrudersPerTool = 2; constexpr unsigned int MaxTriggers = 16; // Maximum number of triggers -constexpr size_t NumSerialChannels = 1; // The number of serial IO channels (USB and one auxiliary UART) +constexpr size_t NumSerialChannels = 2; // The number of serial IO channels (USB and one auxiliary UART) #define SERIAL_MAIN_DEVICE (serialUSB) +#define SERIAL_AUX_DEVICE (serialUart0) // SerialUSB constexpr Pin UsbVBusPin = PortBPin(6); // Pin used to monitor VBUS on USB port -//#define I2C_IFACE Wire // First and only I2C interface -//#define I2C_IRQn WIRE_ISR_ID - // The numbers of entries in each array must correspond with the values of DRIVES, AXES, or HEATERS. Set values to NoPin to flag unavailability. // Drivers @@ -157,7 +156,7 @@ constexpr uint8_t TMC22xxSercomRxPad = 1; constexpr uint32_t DriversBaudRate = 100000; // at 100kbaud a transfer may take up to 2ms constexpr uint32_t TransferTimeout = 6; // any transfer should complete within 6 ticks @ 1ms/tick. 5 wasn't quite enough. constexpr uint32_t DefaultStandstillCurrentPercent = 75; -constexpr float DriverSenseResistor = 0.056 + 0.02; // in ohms +constexpr float DriverSenseResistor = 0.056 + 0.02 + 0.012; // in ohms. The 0.012 is an additional correction for this board. constexpr float DriverVRef = 180.0; // in mV constexpr float DriverFullScaleCurrent = DriverVRef/DriverSenseResistor; // in mA @@ -172,7 +171,7 @@ constexpr Pin VrefSensePin = PortBPin(5); constexpr float DefaultThermistorSeriesR = 2200.0; // Thermistor series resistor value in ohms constexpr float MinVrefLoadR = (DefaultThermistorSeriesR / NumThermistorInputs) * 4700.0/((DefaultThermistorSeriesR / NumThermistorInputs) + 4700.0); - // there are 3 temperature sensing channels and a 4K7 load resistor + // there are 2 temperature sensing channels and a 4K7 load resistor constexpr float VrefSeriesR = 27.0; // Analogue pin numbers @@ -181,28 +180,29 @@ constexpr float PowerMonitorVoltageRange = 11.0 * 3.3; // We use an 11:1 vo #ifdef DEBUG constexpr Pin DiagPin = NoPin; // Diag/status LED pin is shared with SWD -constexpr Pin ActLedPin = NoPin; // Activity LED pin is shared with SWCLK #else constexpr Pin DiagPin = PortAPin(31); // Diag/status LED pin -constexpr Pin ActLedPin = NoPin; // Activity LED pin (not present) #endif +constexpr Pin ActLedPin = NoPin; // Activity LED pin (not present) + constexpr bool DiagOnPolarity = false; constexpr bool ActOnPolarity = false; // SD cards constexpr size_t NumSdCards = 2; -constexpr Pin SdCardDetectPins[NumSdCards] = { PortBPin(16), PortBPin(0) }; +constexpr Pin SdCardDetectPins[NumSdCards] = { PortBPin(16), /*PortBPin(0)*/ NoPin }; constexpr Pin SdWriteProtectPins[NumSdCards] = { NoPin, NoPin }; -constexpr Pin SdSpiCSPins[NumSdCards - 1] = { PortCPin(14) }; +constexpr Pin SdSpiCSPins[NumSdCards - HAS_HIGH_SPEED_SD] = { PortCPin(14) }; constexpr Pin SdMciPins[] = { PortAPin(20), PortAPin(21), PortBPin(18), PortBPin(19), PortBPin(20), PortBPin(21) }; constexpr GpioPinFunction SdMciPinsFunction = GpioPinFunction::I; -Sdhc * const SdDevice = SDHC0; -constexpr IRQn_Type SdhcIRQn = SDHC0_IRQn; +Sdhc * const SdhcDevice = SDHC1; +constexpr IRQn_Type SdhcIRQn = SDHC1_IRQn; constexpr uint32_t ExpectedSdCardSpeed = 15000000; // LCD interface +constexpr uint32_t LcdSpiClockFrequency = 4000000; // 4.0MHz constexpr unsigned int LcdSercomNumber = 0; constexpr Pin LcdSpiMosiPin = PortAPin(4); constexpr Pin LcdSpiMisoPin = PortAPin(7); @@ -225,6 +225,9 @@ constexpr Pin RtpSpiSclkPin = PortCPin(17); constexpr Pin RtpSpiCsPin = PortCPin(18); constexpr GpioPinFunction RtpSpiPinFunction = GpioPinFunction::C; +// Beeper +constexpr Pin BeeperPins[2] = { PortAPin(8), PortAPin(9) }; + // Shared SPI definitions constexpr uint8_t SharedSpiSercomNumber = 7; constexpr Pin SharedSpiMosiPin = PortCPin(12); @@ -232,7 +235,17 @@ constexpr Pin SharedSpiMisoPin = PortCPin(15); constexpr Pin SharedSpiSclkPin = PortCPin(13); constexpr GpioPinFunction SharedSpiPinFunction = GpioPinFunction::C; -// No external serial interfaces +// Serial on IO0 +constexpr uint8_t Serial0SercomNumber = 2; +constexpr uint8_t Sercom0RxPad = 1; +#define SERIAL0_ISR0 SERCOM2_0_Handler +#define SERIAL0_ISR1 SERCOM2_1_Handler +#define SERIAL0_ISR2 SERCOM2_2_Handler +#define SERIAL0_ISR3 SERCOM2_3_Handler + +constexpr Pin Serial0TxPin = PortBPin(25); +constexpr Pin Serial0RxPin = PortBPin(24); +constexpr GpioPinFunction Serial0PinFunction = GpioPinFunction::D; // WiFi pins constexpr unsigned int WiFiUartSercomNumber = 3; @@ -283,8 +296,8 @@ constexpr PinDescription PinTable[] = { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA05 LCD SCLK { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA06 LCD CS { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA07 LCD MOSI - { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA08 Buzzer A - { TcOutput::tc0_1, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA09 Buzzer B + { TcOutput::none, TccOutput::tcc0_0F, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA08 Buzzer A + { TcOutput::none, TccOutput::tcc0_1F, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA09 Buzzer B { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, 10, PinCapability::none, "ate.d0.diag" }, // PA10 driver 0 diag { TcOutput::tc1_1, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::wpwm, "out4" }, // PA11 OUT4 { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PA12 WiFi SCLK (SERCOM4.1) @@ -340,7 +353,7 @@ constexpr PinDescription PinTable[] = { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PB28 not on chip { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::none, SercomIo::none, Nx, PinCapability::none, nullptr }, // PB29 not on chip { TcOutput::none, TccOutput::none, AdcInput::none, SercomIo::sercom5d, SercomIo::none, 14, PinCapability::read, "io3.in" }, // PB30 IO3_IN - { TcOutput::none, TccOutput::tcc0_7G, AdcInput::none, SercomIo::none, SercomIo::sercom5d, Nx, PinCapability::wpwm, "io3.out" }, // PB31 IO3_OUT + { TcOutput::none, TccOutput::tcc4_1F, AdcInput::none, SercomIo::none, SercomIo::sercom5d, Nx, PinCapability::wpwm, "io3.out" }, // PB31 IO3_OUT // Port C { TcOutput::none, TccOutput::none, AdcInput::adc1_10, SercomIo::none, SercomIo::none, Nx, PinCapability::ain, "temp0" }, // PC00 thermistor0 diff --git a/src/FilamentMonitors/FilamentMonitor.cpp b/src/FilamentMonitors/FilamentMonitor.cpp index f50a84c4..3f76bc62 100644 --- a/src/FilamentMonitors/FilamentMonitor.cpp +++ b/src/FilamentMonitors/FilamentMonitor.cpp @@ -335,7 +335,7 @@ bool FilamentMonitor::IsValid(size_t extruderNumber) const noexcept } else { - Event::AddEvent(EventType::filament_error, (uint16_t)fst.ToBaseType(), extruder, CanInterface::GetCanAddress(), ""); + Event::AddEvent(EventType::filament_error, (uint16_t)fst.ToBaseType(), CanInterface::GetCanAddress(), extruder, ""); } } } diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index 871985f8..32fd1342 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -276,7 +276,7 @@ void GCodes::Reset() noexcept rp.Init(); } - for (Trigger& tr : triggers) + for (TriggerItem& tr : triggers) { tr.Init(); } @@ -958,7 +958,7 @@ void GCodes::DoPause(GCodeBuffer& gb, PrintPausedReason reason, GCodeState newSt #if SUPPORT_LASER if (machineType == MachineType::laser) { - moveState.laserPwmOrIoBits.laserPwm = 0; // turn off the laser when we start moving + moveState.laserPwmOrIoBits.laserPwm = 0; // turn off the laser when we start moving } #endif @@ -988,6 +988,8 @@ void GCodes::DoPause(GCodeBuffer& gb, PrintPausedReason reason, GCodeState newSt // Make sure we expose usable values (which noFilePosition is not) pauseRestorePoint.filePos = 0; } + + reprap.StateUpdated(); // test DWC/DSF that we have changed a restore point } // Check if a pause is pending, action it if so @@ -3133,7 +3135,9 @@ bool GCodes::QueueFileToPrint(const char* fileName, const StringRef& reply) noex // Start printing the file already selected. We must hold the movement lock and wait for all moves to finish before calling this, because of the call to ResetMoveCounters. void GCodes::StartPrinting(bool fromStart) noexcept { +#if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES fileOffsetToPrint = 0; +#endif restartMoveFractionDone = 0.0; buildObjects.Init(); @@ -3225,10 +3229,10 @@ GCodeResult GCodes::DoDwell(GCodeBuffer& gb) THROWS(GCodeException) // Get the tool specified by the P parameter, or the current tool if no P parameter ReadLockedPointer<Tool> GCodes::GetSpecifiedOrCurrentTool(GCodeBuffer& gb) THROWS(GCodeException) { - unsigned int tNumber; + int tNumber; if (gb.Seen('P')) { - tNumber = gb.GetUIValue(); + tNumber = (int)gb.GetUIValue(); } else { @@ -3690,7 +3694,7 @@ void GCodes::HandleReplyPreserveResult(GCodeBuffer& gb, GCodeResult rslt, const case Compatibility::Sprinter: case Compatibility::Repetier: default: - platform.MessageF(mt, "Emulation of %s is not yet supported.\n", gb.LatestMachineState().compatibility.ToString()); + platform.MessageF(mt, "Emulation of %s is not supported\n", gb.LatestMachineState().compatibility.ToString()); break; } } @@ -3736,36 +3740,41 @@ void GCodes::HandleReply(GCodeBuffer& gb, OutputBuffer *reply) noexcept case Compatibility::Marlin: case Compatibility::NanoDLP: - if (gb.GetCommandLetter() =='M' && gb.GetCommandNumber() == 20) + if (gb.GetCommandLetter() == 'M') { - platform.Message(type, "Begin file list\n"); - platform.Message(type, reply); - platform.MessageF(type, "End file list\n%s\n", response); - return; - } + // The response to some M-codes is handled differently in Marlin mode + if ( gb.GetCommandNumber() == 20 // M20 in Marlin mode adds text around the file list + && ((*reply)[0] != '{' || (*reply)[1] != '"') // ...but don't if it looks like a JSON response + ) + { + platform.Message(type, "Begin file list\n"); + platform.Message(type, reply); + platform.MessageF(type, "End file list\n%s\n", response); + return; + } - if (gb.GetCommandLetter() == 'M' && gb.GetCommandNumber() == 28) - { - platform.MessageF(type, "%s\n", response); - platform.Message(type, reply); - return; - } + if (gb.GetCommandNumber() == 28) + { + platform.MessageF(type, "%s\n", response); + platform.Message(type, reply); + return; + } - if (gb.GetCommandLetter() =='M' && (gb.GetCommandNumber() == 105 || gb.GetCommandNumber() == 998)) - { - platform.MessageF(type, "%s ", response); - platform.Message(type, reply); - return; + if (gb.GetCommandNumber() == 105 || gb.GetCommandNumber() == 998) + { + platform.MessageF(type, "%s ", response); + platform.Message(type, reply); + return; + } } - if (reply->Length() != 0 && !gb.IsDoingFileMacro()) - { - platform.Message(type, reply); - platform.MessageF(type, "\n%s\n", response); - } - else if (reply->Length() != 0) + if (reply->Length() != 0) { platform.Message(type, reply); + if (!gb.IsDoingFileMacro()) + { + platform.MessageF(type, "\n%s\n", response); + } } else { @@ -3778,7 +3787,7 @@ void GCodes::HandleReply(GCodeBuffer& gb, OutputBuffer *reply) noexcept case Compatibility::Sprinter: case Compatibility::Repetier: default: - platform.MessageF(type, "Emulation of %s is not yet supported.\n", gb.LatestMachineState().compatibility.ToString()); + platform.MessageF(type, "Emulation of %s is not supported\n", gb.LatestMachineState().compatibility.ToString()); break; } diff --git a/src/GCodes/GCodes.h b/src/GCodes/GCodes.h index 010d9671..03656ea9 100644 --- a/src/GCodes/GCodes.h +++ b/src/GCodes/GCodes.h @@ -32,7 +32,7 @@ Licence: GPL #include "GCodeChannel.h" #include "GCodeInput.h" #include "GCodeMachineState.h" -#include "Trigger.h" +#include <GCodes/TriggerItem.h> #include <Tools/Filament.h> #include <FilamentMonitors/FilamentMonitor.h> #include "RestorePoint.h" @@ -664,7 +664,7 @@ private: bool updateFileWhenSimulationComplete; // true if simulated time should be appended to the file // Triggers - Trigger triggers[MaxTriggers]; // Trigger conditions + TriggerItem triggers[MaxTriggers]; // Trigger conditions TriggerNumbersBitmap triggersPending; // Bitmap of triggers pending but not yet executed // Firmware update diff --git a/src/GCodes/GCodes3.cpp b/src/GCodes/GCodes3.cpp index 8530975f..1f09dad2 100644 --- a/src/GCodes/GCodes3.cpp +++ b/src/GCodes/GCodes3.cpp @@ -56,6 +56,7 @@ GCodeResult GCodes::SavePosition(GCodeBuffer& gb, const StringRef& reply) THROWS bool dummySeen; gb.TryGetLimitedUIValue('S', sParam, dummySeen, NumRestorePoints); SavePosition(numberedRestorePoints[sParam], gb); + reprap.StateUpdated(); // tell DWC/DSF that a restore point has been changed return GCodeResult::ok; } @@ -1918,6 +1919,8 @@ void GCodes::ProcessEvent(GCodeBuffer& gb) noexcept // Get the name of the macro file that we should look for String<StringLength50> macroName; Event::GetMacroFileName(macroName.GetRef()); + +#if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES if (platform.SysFileExists(macroName.c_str())) { // Set up the macro parameters @@ -1932,6 +1935,7 @@ void GCodes::ProcessEvent(GCodeBuffer& gb) noexcept return; } } +#endif // We didn't execute the macro, so do the default action if (Event::GetDefaultPauseReason() == PrintPausedReason::dontPause) diff --git a/src/GCodes/GCodes4.cpp b/src/GCodes/GCodes4.cpp index dc227171..48256718 100644 --- a/src/GCodes/GCodes4.cpp +++ b/src/GCodes/GCodes4.cpp @@ -331,6 +331,7 @@ void GCodes::RunStateMachine(GCodeBuffer& gb, const StringRef& reply) noexcept toolChangeRestorePoint.toolNumber = reprap.GetCurrentToolNumber(); toolChangeRestorePoint.fanSpeed = lastDefaultFanSpeed; reprap.SetPreviousToolNumber(); + reprap.StateUpdated(); // tell DWC/DSF that a restore point, nextToolNumber and the previousToolNumber have been updated gb.AdvanceState(); // If the tool is in the firmware-retracted state, there may be some Z hop applied, which we must remove diff --git a/src/GCodes/Trigger.cpp b/src/GCodes/TriggerItem.cpp index 86bd5893..b1282613 100644 --- a/src/GCodes/Trigger.cpp +++ b/src/GCodes/TriggerItem.cpp @@ -5,18 +5,18 @@ * Author: David */ -#include "Trigger.h" +#include "TriggerItem.h" #include <Platform/RepRap.h> #include "GCodes.h" #include <PrintMonitor/PrintMonitor.h> #include "GCodeBuffer/GCodeBuffer.h" -Trigger::Trigger() noexcept : condition(0) +TriggerItem::TriggerItem() noexcept : condition(0) { } // Initialise the trigger -void Trigger::Init() noexcept +void TriggerItem::Init() noexcept { highLevelEndstops.Clear(); lowLevelEndstops.Clear(); @@ -26,14 +26,14 @@ void Trigger::Init() noexcept } // Return true if this trigger is unused, i.e. it doesn't watch any pins -bool Trigger::IsUnused() const noexcept +bool TriggerItem::IsUnused() const noexcept { return highLevelEndstops.IsEmpty() && lowLevelEndstops.IsEmpty() && highLevelInputs.IsEmpty() && lowLevelInputs.IsEmpty(); } // Check whether this trigger is active and update the input states. This is called in a polling loop, so it needs to be fast. // TODO when we switch to interrupt-driven endstops, make this interrupt-driven instead -bool Trigger::Check() noexcept +bool TriggerItem::Check() noexcept { bool triggered = false; @@ -106,7 +106,7 @@ bool Trigger::Check() noexcept } // Handle M581 for this trigger -GCodeResult Trigger::Configure(unsigned int number, GCodeBuffer &gb, const StringRef &reply) +GCodeResult TriggerItem::Configure(unsigned int number, GCodeBuffer &gb, const StringRef &reply) { bool seen = false; if (gb.Seen('R')) @@ -217,14 +217,14 @@ GCodeResult Trigger::Configure(unsigned int number, GCodeBuffer &gb, const Strin } // Handle M582 for this trigger -bool Trigger::CheckLevel() noexcept +bool TriggerItem::CheckLevel() noexcept { endstopStates = lowLevelEndstops; inputStates = lowLevelInputs; return Check(); } -void Trigger::AppendInputNames(AxesBitmap endstops, InputPortsBitmap inputs, const StringRef &reply) noexcept +void TriggerItem::AppendInputNames(AxesBitmap endstops, InputPortsBitmap inputs, const StringRef &reply) noexcept { if (endstops.IsEmpty() && inputs.IsEmpty()) { diff --git a/src/GCodes/Trigger.h b/src/GCodes/TriggerItem.h index bdf1ac24..4adc2dba 100644 --- a/src/GCodes/Trigger.h +++ b/src/GCodes/TriggerItem.h @@ -5,16 +5,16 @@ * Author: David */ -#ifndef SRC_GCODES_TRIGGER_H_ -#define SRC_GCODES_TRIGGER_H_ +#ifndef SRC_GCODES_TRIGGERITEM_H_ +#define SRC_GCODES_TRIGGERITEM_H_ #include <RepRapFirmware.h> #include <Hardware/IoPorts.h> -class Trigger +class TriggerItem { public: - Trigger() noexcept; + TriggerItem() noexcept; void Init() noexcept; @@ -38,4 +38,4 @@ private: int8_t condition; }; -#endif /* SRC_GCODES_TRIGGER_H_ */ +#endif /* SRC_GCODES_TRIGGERITEM_H_ */ diff --git a/src/Hardware/SAME5x/Devices.cpp b/src/Hardware/SAME5x/Devices.cpp index 22aef25c..30d4dbbd 100644 --- a/src/Hardware/SAME5x/Devices.cpp +++ b/src/Hardware/SAME5x/Devices.cpp @@ -117,6 +117,8 @@ static void UsbInit() noexcept gpio_set_pin_function(PortAPin(25), PINMUX_PA25H_USB_DP); } +#if HAS_HIGH_SPEED_SD + static void SdhcInit() noexcept { // Set up SDHC clock @@ -125,11 +127,11 @@ static void SdhcInit() noexcept hri_mclk_set_AHBMASK_SDHC1_bit(MCLK); hri_gclk_write_PCHCTRL_reg(GCLK, SDHC1_GCLK_ID, GCLK_PCHCTRL_GEN(GclkNum90MHz) | GCLK_PCHCTRL_CHEN); hri_gclk_write_PCHCTRL_reg(GCLK, SDHC1_GCLK_ID_SLOW, GCLK_PCHCTRL_GEN(GclkNum31KHz) | GCLK_PCHCTRL_CHEN); -#elif defined(DUET3MINI4) - // Using SDHC 0 - hri_mclk_set_AHBMASK_SDHC0_bit(MCLK); - hri_gclk_write_PCHCTRL_reg(GCLK, SDHC0_GCLK_ID, GCLK_PCHCTRL_GEN(GclkNum90MHz) | GCLK_PCHCTRL_CHEN); - hri_gclk_write_PCHCTRL_reg(GCLK, SDHC0_GCLK_ID_SLOW, GCLK_PCHCTRL_GEN(GclkNum31KHz) | GCLK_PCHCTRL_CHEN); +#elif defined(FMDC_V02) + // Using SDHC 1 on v0.2 board + hri_mclk_set_AHBMASK_SDHC1_bit(MCLK); + hri_gclk_write_PCHCTRL_reg(GCLK, SDHC1_GCLK_ID, GCLK_PCHCTRL_GEN(GclkNum90MHz) | GCLK_PCHCTRL_CHEN); + hri_gclk_write_PCHCTRL_reg(GCLK, SDHC1_GCLK_ID_SLOW, GCLK_PCHCTRL_GEN(GclkNum31KHz) | GCLK_PCHCTRL_CHEN); #else # error Unknown board #endif @@ -141,13 +143,17 @@ static void SdhcInit() noexcept } } +#endif + void DeviceInit() noexcept { // Ensure the Ethernet PHY or WiFi module is held reset pinMode(EspResetPin, OUTPUT_LOW); UsbInit(); +#if HAS_HIGH_SPEED_SD SdhcInit(); +#endif AnalogIn::Init(NvicPriorityAdc); AnalogOut::Init(); diff --git a/src/Hardware/SAME5x/same51n19a_flash.ld b/src/Hardware/SAME5x/same51n19a_flash.ld new file mode 100644 index 00000000..89abd998 --- /dev/null +++ b/src/Hardware/SAME5x/same51n19a_flash.ld @@ -0,0 +1,181 @@ +/** + * \file + * + * \brief Linker script for running in internal FLASH on the SAME51N19A + * + * Copyright (c) 2019 Microchip Technology Inc. + * + * \asf_license_start + * + * \page License + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the Licence at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * \asf_license_stop + * + */ + + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SEARCH_DIR(.) + +/* Memory Spaces Definitions */ +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000 + bkupram (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000 + qspi (rwx) : ORIGIN = 0x04000000, LENGTH = 0x01000000 +} + +/* Section Definitions */ +SECTIONS +{ + .text : + { + . = ALIGN(4); + _sfixed = .; + KEEP(*(.vectors .vectors.*)) + *(.text .text.* .gnu.linkonce.t.*) + *(.glue_7t) *(.glue_7) + *(.rodata .rodata* .gnu.linkonce.r.*) + + /* Support C constructors, and C destructors in both user code + and the C library. This also provides support for C++ code. */ + . = ALIGN(4); + KEEP(*(.init)) + . = ALIGN(4); + __preinit_array_start = .; + KEEP (*(.preinit_array)) + __preinit_array_end = .; + + . = ALIGN(4); + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + + . = ALIGN(4); + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + + . = ALIGN(4); + KEEP(*(.fini)) + + . = ALIGN(4); + __fini_array_start = .; + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + __fini_array_end = .; + + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + + . = ALIGN(4); + _efixed = .; /* End of text section */ + } > rom + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > rom + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > rom + PROVIDE_HIDDEN (__exidx_end = .); + + . = ALIGN(4); + _etext = .; + + /* CAN message buffers must be in the first 64K of RAM */ + .canMessage (NOLOAD) : + { + . = ALIGN(4); + _sCanMessage = . ; + *(.CanMessage .CanMessage.*) + . = ALIGN(4); + _eCanMessage = . ; + } > ram + + .relocate : AT (_etext) + { + . = ALIGN(4); + _srelocate = .; + *(.ramfunc .ramfunc.*); + *(.data .data.*); + . = ALIGN(4); + _erelocate = .; + } > ram + + _firmware_end = _etext + (_erelocate - _srelocate); /* Embedded files start here */ + _firmware_crc = _firmware_end; /* We append the CRC32 to the binary file. This is its offset in memory if we don't append embedded files */ + + /* .bss section which is used for uninitialized data */ + .bss ALIGN(16) (NOLOAD) : + { + _sbss = . ; + _szero = .; + *(.bss .bss.*) + *(COMMON) + . = ALIGN(4); + _ebss = . ; + _ezero = .; + } > ram + + . = ALIGN(4); + _end = . ; + + /* .stack_dummy section doesn't contains any symbols. It is only + used for linker to calculate size of stack sections, and assign + values to stack symbols later */ + .stack_dummy : + { + *(.stack*) + } > ram + + .bkupram (NOLOAD): + { + . = ALIGN(8); + _sbkupram = .; + *(.bkupram .bkupram.*); + . = ALIGN(8); + _ebkupram = .; + } > bkupram + + .qspi (NOLOAD): + { + . = ALIGN(8); + _sqspi = .; + *(.qspi .qspi.*); + . = ALIGN(8); + _eqspi = .; + } > qspi + + /* Set stack top to end of ram, and stack limit move down by + * size of stack_dummy section */ + __StackTop = ORIGIN(ram) + LENGTH(ram); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(_sstack = __StackLimit); + PROVIDE(_estack = __StackTop); +} diff --git a/src/Heating/LocalHeater.cpp b/src/Heating/LocalHeater.cpp index 45c73d1a..6b077304 100644 --- a/src/Heating/LocalHeater.cpp +++ b/src/Heating/LocalHeater.cpp @@ -936,7 +936,7 @@ void LocalHeater::RaiseHeaterFault(HeaterFaultType type, const char *_ecv_array else #endif { - Event::AddEventV(EventType::heater_fault, (uint16_t)type, GetHeaterNumber(), CanInterface::GetCanAddress(), format, vargs); + Event::AddEventV(EventType::heater_fault, (uint16_t)type, CanInterface::GetCanAddress(), GetHeaterNumber(), format, vargs); } va_end(vargs); } diff --git a/src/Libraries/sd_mmc/ctrl_access.c b/src/Libraries/sd_mmc/ctrl_access.cpp index 3ed468d0..7932c73d 100644 --- a/src/Libraries/sd_mmc/ctrl_access.c +++ b/src/Libraries/sd_mmc/ctrl_access.cpp @@ -63,22 +63,22 @@ #include "sd_mmc_mem.h" -Ctrl_status mem_test_unit_ready(uint8_t lun) +Ctrl_status mem_test_unit_ready(uint8_t lun) noexcept { return (lun < MAX_LUN) ? sd_mmc_test_unit_ready(lun) : CTRL_FAIL; } -Ctrl_status mem_read_capacity(uint8_t lun, uint32_t *u32_nb_sector) +Ctrl_status mem_read_capacity(uint8_t lun, uint32_t *u32_nb_sector) noexcept { return (lun < MAX_LUN) ? sd_mmc_read_capacity(lun, u32_nb_sector) : CTRL_FAIL; } -uint8_t mem_sector_size(uint8_t lun) +uint8_t mem_sector_size(uint8_t lun) noexcept { return 1; } -bool mem_wr_protect(uint8_t lun) +bool mem_wr_protect(uint8_t lun) noexcept { #if SUPPORT_WRITE_PROTECT return (lun >= MAX_LUN) || sd_mmc_wr_protect(lun)e; @@ -87,12 +87,12 @@ bool mem_wr_protect(uint8_t lun) #endif } -Ctrl_status memory_2_ram(uint8_t lun, uint32_t addr, void *ram, uint32_t numBlocks) +Ctrl_status memory_2_ram(uint8_t lun, uint32_t addr, void *ram, uint32_t numBlocks) noexcept { return (lun < MAX_LUN) ? sd_mmc_mem_2_ram(lun, addr, ram, numBlocks) : CTRL_FAIL; } -Ctrl_status ram_2_memory(uint8_t lun, uint32_t addr, const void *ram, uint32_t numBlocks) +Ctrl_status ram_2_memory(uint8_t lun, uint32_t addr, const void *ram, uint32_t numBlocks) noexcept { return (lun < MAX_LUN) ? sd_mmc_ram_2_mem(lun, addr, ram, numBlocks) : CTRL_FAIL; } diff --git a/src/Libraries/sd_mmc/sd_mmc.c b/src/Libraries/sd_mmc/sd_mmc.cpp index 11d0cd75..baccd68d 100644 --- a/src/Libraries/sd_mmc/sd_mmc.c +++ b/src/Libraries/sd_mmc/sd_mmc.cpp @@ -47,8 +47,8 @@ // 2021-02-03: MC and DC converted this to be re-entrant, provided that only one task uses each interface. // Currently all RRF configurations for Duets support at most one HSMCI and one SPI card, and there is a mutex for each volume, so this is the case. -#include <Core.h> // for digitalRead() and pinMode() -#include <string.h> +#include <RepRapFirmware.h> +#include <cstring> #define SUPPORT_SDHC 1 @@ -82,27 +82,27 @@ extern void debugPrintf(const char* fmt, ...); # error SD_MMC_SPI_MEM_CNT not defined #endif -typedef void (*driverIdleFunc_t)(uint32_t, uint32_t); +typedef void (*driverIdleFunc_t)(uint32_t, uint32_t) noexcept; struct DriverInterface { - bool (*select_device)(uint8_t slot, uint32_t clock, uint8_t bus_width, bool high_speed); - void (*deselect_device)(uint8_t slot); - uint8_t (*get_bus_width)(uint8_t slot); - bool (*is_high_speed_capable)(void); - void (*send_clock)(void); - bool (*send_cmd)(sdmmc_cmd_def_t cmd, uint32_t arg); - uint32_t (*get_response)(void); - void (*get_response_128)(uint8_t* response); - bool (*adtc_start)(sdmmc_cmd_def_t cmd, uint32_t arg, uint16_t block_size, uint16_t nb_block, const void* dmaAddr); - bool (*adtc_stop)(sdmmc_cmd_def_t cmd, uint32_t arg); - bool (*read_word)(uint32_t* value); - bool (*write_word)(uint32_t value); - bool (*start_read_blocks)(void *dest, uint16_t nb_block); - bool (*wait_end_of_read_blocks)(void); - bool (*start_write_blocks)(const void *src, uint16_t nb_block); - bool (*wait_end_of_write_blocks)(void); - uint32_t (*getInterfaceSpeed)(void); + bool (*select_device)(uint8_t slot, uint32_t clock, uint8_t bus_width, bool high_speed) noexcept; + void (*deselect_device)(uint8_t slot) noexcept; + uint8_t (*get_bus_width)(uint8_t slot) noexcept; + bool (*is_high_speed_capable)(void) noexcept; + void (*send_clock)(void) noexcept; + bool (*send_cmd)(sdmmc_cmd_def_t cmd, uint32_t arg) noexcept; + uint32_t (*get_response)(void) noexcept; + void (*get_response_128)(uint8_t* response) noexcept; + bool (*adtc_start)(sdmmc_cmd_def_t cmd, uint32_t arg, uint16_t block_size, uint16_t nb_block, const void* dmaAddr) noexcept; + bool (*adtc_stop)(sdmmc_cmd_def_t cmd, uint32_t arg) noexcept; + bool (*read_word)(uint32_t* value) noexcept; + bool (*write_word)(uint32_t value) noexcept; + bool (*start_read_blocks)(void *dest, uint16_t nb_block) noexcept; + bool (*wait_end_of_read_blocks)(void) noexcept; + bool (*start_write_blocks)(const void *src, uint16_t nb_block) noexcept; + bool (*wait_end_of_write_blocks)(void) noexcept; + uint32_t (*getInterfaceSpeed)(void) noexcept; driverIdleFunc_t (*set_idle_func)(driverIdleFunc_t); bool is_spi; // true if the interface is SPI, false if it is HSMCI }; @@ -928,7 +928,7 @@ static bool mmc_cmd8(uint8_t *b_authorize_high_speed, uint8_t slot) uint32_t sec_count; struct sd_mmc_card * const sd_mmc_card = &sd_mmc_cards[slot]; - if (!sd_mmc_card->iface->adtc_start(MMC_CMD8_SEND_EXT_CSD, 0, EXT_CSD_BSIZE, 1, false)) { + if (!sd_mmc_card->iface->adtc_start(MMC_CMD8_SEND_EXT_CSD, 0, EXT_CSD_BSIZE, 1, nullptr)) { return false; } //** Read and decode Extended Extended CSD @@ -1796,7 +1796,7 @@ static bool sd_mmc_mci_install_mmc(uint8_t slot) //------------------------------------------------------------------- //--------------------- PUBLIC FUNCTIONS ---------------------------- -void sd_mmc_init(const Pin wpPins[], const Pin spiCsPins[]) +void sd_mmc_init(const Pin wpPins[], const Pin spiCsPins[]) noexcept { for (size_t slot = 0; slot < SD_MMC_MEM_CNT; slot++) { @@ -1827,7 +1827,11 @@ void sd_mmc_init(const Pin wpPins[], const Pin spiCsPins[]) // sd_mmc_slot_sel = 0xFF; // No slot selected #if SD_MMC_HSMCI_MEM_CNT != 0 +# if SAME5x + hsmci_init(SdhcDevice, SdhcIRQn); +# else hsmci_init(); +# endif #endif #if SD_MMC_SPI_MEM_CNT != 0 @@ -1835,14 +1839,14 @@ void sd_mmc_init(const Pin wpPins[], const Pin spiCsPins[]) #endif } -uint8_t sd_mmc_nb_slot(void) +uint8_t sd_mmc_nb_slot(void) noexcept { return SD_MMC_MEM_CNT; } // Check that the card is ready and initialise it if necessary // The card is not selected on entry or at exit -sd_mmc_err_t sd_mmc_check(uint8_t slot) +sd_mmc_err_t sd_mmc_check(uint8_t slot) noexcept { sd_mmc_err_t sd_mmc_err = sd_mmc_select_slot(slot); if (sd_mmc_err != SD_MMC_INIT_ONGOING) @@ -1867,7 +1871,7 @@ sd_mmc_err_t sd_mmc_check(uint8_t slot) return SD_MMC_ERR_UNUSABLE; } -card_type_t sd_mmc_get_type(uint8_t slot) +card_type_t sd_mmc_get_type(uint8_t slot) noexcept { if (SD_MMC_OK != sd_mmc_select_slot(slot)) { return CARD_TYPE_UNKNOWN; @@ -1876,7 +1880,7 @@ card_type_t sd_mmc_get_type(uint8_t slot) return sd_mmc_cards[slot].type; } -card_version_t sd_mmc_get_version(uint8_t slot) +card_version_t sd_mmc_get_version(uint8_t slot) noexcept { if (SD_MMC_OK != sd_mmc_select_slot(slot)) { return CARD_VER_UNKNOWN; @@ -1885,7 +1889,7 @@ card_version_t sd_mmc_get_version(uint8_t slot) return sd_mmc_cards[slot].version; } -uint32_t sd_mmc_get_capacity(uint8_t slot) +uint32_t sd_mmc_get_capacity(uint8_t slot) noexcept { #if 1 // This will only check for already present data. The old code below is unsafe if another task is accessing data already. if (slot < SD_MMC_MEM_CNT && sd_mmc_cards[slot].state == SD_MMC_CARD_STATE_READY) @@ -1915,13 +1919,13 @@ bool sd_mmc_is_write_protected(uint8_t slot) #if 1 // dc42 // Unmount the card. Must call this to force it to be re-initialised when changing card. -void sd_mmc_unmount(uint8_t slot) +void sd_mmc_unmount(uint8_t slot) noexcept { sd_mmc_cards[slot].state = SD_MMC_CARD_STATE_NO_CARD; } // Get the interface speed in bytes/sec -uint32_t sd_mmc_get_interface_speed(uint8_t slot) +uint32_t sd_mmc_get_interface_speed(uint8_t slot) noexcept { return sd_mmc_cards[slot].iface->getInterfaceSpeed(); } @@ -1944,7 +1948,7 @@ void sd_mmc_change_cs_pin(uint8_t slot, Pin csPin) noexcept // Initialise for reading blocks // On entry the card is not selected // If SD_MMC_OK is returned then the card is selected, otherwise it is not selected -sd_mmc_err_t sd_mmc_init_read_blocks(uint8_t slot, uint32_t start, uint16_t nb_block, void *dmaAddr) +sd_mmc_err_t sd_mmc_init_read_blocks(uint8_t slot, uint32_t start, uint16_t nb_block, void *dmaAddr) noexcept { sd_mmc_err_t sd_mmc_err; uint32_t cmd, arg, resp; @@ -2000,7 +2004,7 @@ sd_mmc_err_t sd_mmc_init_read_blocks(uint8_t slot, uint32_t start, uint16_t nb_b // Start reading blocks // On entry the card is selected // If SD_MMC_OK is returned then the card is selected, otherwise it is not selected -sd_mmc_err_t sd_mmc_start_read_blocks(void *dest, uint16_t nb_block, uint8_t slot) +sd_mmc_err_t sd_mmc_start_read_blocks(void *dest, uint16_t nb_block, uint8_t slot) noexcept { Assert(sd_mmc_nb_block_remaining[slot] >= nb_block); @@ -2017,7 +2021,7 @@ sd_mmc_err_t sd_mmc_start_read_blocks(void *dest, uint16_t nb_block, uint8_t slo // Wait until all blocks have been read // On entry the device is selected // On return it is not selected -sd_mmc_err_t sd_mmc_wait_end_of_read_blocks(bool abort, uint8_t slot) +sd_mmc_err_t sd_mmc_wait_end_of_read_blocks(bool abort, uint8_t slot) noexcept { struct sd_mmc_card * const sd_mmc_card = &sd_mmc_cards[slot]; if (!sd_mmc_card->iface->wait_end_of_read_blocks()) { @@ -2050,7 +2054,7 @@ sd_mmc_err_t sd_mmc_wait_end_of_read_blocks(bool abort, uint8_t slot) // Initialise for writing blocks // On entry the card is not selected // If SD_MMC_OK is returned then the card is selected, otherwise it is not selected -sd_mmc_err_t sd_mmc_init_write_blocks(uint8_t slot, uint32_t start, uint16_t nb_block, const void *dmaAddr) +sd_mmc_err_t sd_mmc_init_write_blocks(uint8_t slot, uint32_t start, uint16_t nb_block, const void *dmaAddr) noexcept { sd_mmc_err_t sd_mmc_err; uint32_t cmd, arg, resp; @@ -2106,7 +2110,7 @@ sd_mmc_err_t sd_mmc_init_write_blocks(uint8_t slot, uint32_t start, uint16_t nb_ // Start writing blocks // On entry the card is selected // If SD_MMC_OK is returned then the card is selected, otherwise it is not selected -sd_mmc_err_t sd_mmc_start_write_blocks(const void *src, uint16_t nb_block, uint8_t slot) +sd_mmc_err_t sd_mmc_start_write_blocks(const void *src, uint16_t nb_block, uint8_t slot) noexcept { Assert(sd_mmc_nb_block_remaining[slot] >= nb_block); struct sd_mmc_card * const sd_mmc_card = &sd_mmc_cards[slot]; @@ -2122,7 +2126,7 @@ sd_mmc_err_t sd_mmc_start_write_blocks(const void *src, uint16_t nb_block, uint8 // Wait until all blocks have been written // On entry the device is selected // On return it is not selected -sd_mmc_err_t sd_mmc_wait_end_of_write_blocks(bool abort, uint8_t slot) +sd_mmc_err_t sd_mmc_wait_end_of_write_blocks(bool abort, uint8_t slot) noexcept { struct sd_mmc_card * const sd_mmc_card = &sd_mmc_cards[slot]; if (!sd_mmc_card->iface->wait_end_of_write_blocks()) { @@ -2156,8 +2160,7 @@ sd_mmc_err_t sd_mmc_wait_end_of_write_blocks(bool abort, uint8_t slot) } #ifdef SDIO_SUPPORT_ENABLE -sd_mmc_err_t sdio_read_direct(uint8_t slot, uint8_t func_num, uint32_t addr, - uint8_t *dest) +sd_mmc_err_t sdio_read_direct(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t *dest) noexcept { sd_mmc_err_t sd_mmc_err; @@ -2178,8 +2181,7 @@ sd_mmc_err_t sdio_read_direct(uint8_t slot, uint8_t func_num, uint32_t addr, return SD_MMC_OK; } -sd_mmc_err_t sdio_write_direct(uint8_t slot, uint8_t func_num, uint32_t addr, - uint8_t data) +sd_mmc_err_t sdio_write_direct(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t data) noexcept { sd_mmc_err_t sd_mmc_err; @@ -2197,8 +2199,7 @@ sd_mmc_err_t sdio_write_direct(uint8_t slot, uint8_t func_num, uint32_t addr, return SD_MMC_OK; } -sd_mmc_err_t sdio_read_extended(uint8_t slot, uint8_t func_num, uint32_t addr, - uint8_t inc_addr, uint8_t *dest, uint16_t size) +sd_mmc_err_t sdio_read_extended(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t inc_addr, uint8_t *dest, uint16_t size) noexcept { sd_mmc_err_t sd_mmc_err; @@ -2229,8 +2230,7 @@ sd_mmc_err_t sdio_read_extended(uint8_t slot, uint8_t func_num, uint32_t addr, return SD_MMC_OK; } -sd_mmc_err_t sdio_write_extended(uint8_t slot, uint8_t func_num, uint32_t addr, - uint8_t inc_addr, uint8_t *src, uint16_t size) +sd_mmc_err_t sdio_write_extended(uint8_t slot, uint8_t func_num, uint32_t addr, uint8_t inc_addr, uint8_t *src, uint16_t size) noexcept { sd_mmc_err_t sd_mmc_err; diff --git a/src/Libraries/sd_mmc/sd_mmc_mem.c b/src/Libraries/sd_mmc/sd_mmc_mem.cpp index 4789f90f..33a2afb5 100644 --- a/src/Libraries/sd_mmc/sd_mmc_mem.c +++ b/src/Libraries/sd_mmc/sd_mmc_mem.cpp @@ -59,7 +59,7 @@ * @{ */ -Ctrl_status sd_mmc_test_unit_ready(uint8_t slot) +Ctrl_status sd_mmc_test_unit_ready(uint8_t slot) noexcept { switch (sd_mmc_check(slot)) { @@ -81,7 +81,7 @@ Ctrl_status sd_mmc_test_unit_ready(uint8_t slot) } } -Ctrl_status sd_mmc_read_capacity(uint8_t slot, uint32_t *nb_sector) +Ctrl_status sd_mmc_read_capacity(uint8_t slot, uint32_t *nb_sector) noexcept { // Return last sector address (-1) *nb_sector = (sd_mmc_get_capacity(slot) * 2) - 1; @@ -99,7 +99,7 @@ bool sd_mmc_wr_protect(uint8_t slot) * \name MEM <-> RAM Interface * @{ */ -Ctrl_status sd_mmc_mem_2_ram(uint8_t slot, uint32_t addr, void *ram, uint32_t numBlocks) +Ctrl_status sd_mmc_mem_2_ram(uint8_t slot, uint32_t addr, void *ram, uint32_t numBlocks) noexcept { switch (sd_mmc_init_read_blocks(slot, addr, numBlocks, ram)) { case SD_MMC_OK: @@ -118,7 +118,7 @@ Ctrl_status sd_mmc_mem_2_ram(uint8_t slot, uint32_t addr, void *ram, uint32_t nu return CTRL_GOOD; } -Ctrl_status sd_mmc_ram_2_mem(uint8_t slot, uint32_t addr, const void *ram, uint32_t numBlocks) +Ctrl_status sd_mmc_ram_2_mem(uint8_t slot, uint32_t addr, const void *ram, uint32_t numBlocks) noexcept { switch (sd_mmc_init_write_blocks(slot, addr, numBlocks, ram)) { case SD_MMC_OK: diff --git a/src/Movement/DDA.cpp b/src/Movement/DDA.cpp index 9df806b5..7abd7a5c 100644 --- a/src/Movement/DDA.cpp +++ b/src/Movement/DDA.cpp @@ -1422,11 +1422,15 @@ void DDA::Prepare(SimulationMode simMode) noexcept } const int32_t delta = endPoint[drive] - prev->endPoint[drive]; - if (platform.GetDriversBitmap(drive) != 0) // if any of the drives is local + if (platform.GetDriversBitmap(drive) != 0 // if any of the drives is local +#if SUPPORT_CAN_EXPANSION + || flags.checkEndstops // if checking endstops, create a DM even if there are no local drives involved +#endif + ) { DriveMovement* const pdm = DriveMovement::Allocate(drive, DMState::idle); pdm->direction = (delta >= 0); - pdm->totalSteps = labs(delta); // this is net steps for now + pdm->totalSteps = labs(delta); // this is net steps for now if (pdm->PrepareDeltaAxis(*this, params)) { pdm->directionChanged = false; @@ -1543,7 +1547,7 @@ void DDA::Prepare(SimulationMode simMode) noexcept { const NonlinearExtrusion& nl = platform.GetExtrusionCoefficients(extruder); float& dv = directionVector[drive]; - const float averageExtrusionSpeed = (totalDistance * dv)/clocksNeeded; + const float averageExtrusionSpeed = (totalDistance * dv * StepClockRate)/clocksNeeded; // need speed in mm/sec for nonlinear extrusion calculation const float factor = 1.0 + min<float>((averageExtrusionSpeed * nl.A) + (averageExtrusionSpeed * averageExtrusionSpeed * nl.B), nl.limit); dv *= factor; } diff --git a/src/Networking/ESP8266WiFi/WiFiInterface.cpp b/src/Networking/ESP8266WiFi/WiFiInterface.cpp index d540f01f..bb7e0c29 100644 --- a/src/Networking/ESP8266WiFi/WiFiInterface.cpp +++ b/src/Networking/ESP8266WiFi/WiFiInterface.cpp @@ -474,8 +474,9 @@ void WiFiInterface::Activate() noexcept bufferOut = new MessageBufferOut; bufferIn = new MessageBufferIn; +#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES uploader = new WifiFirmwareUploader(SERIAL_WIFI_DEVICE, *this); - +#endif if (requestedMode != WiFiState::disabled) { Start(); @@ -646,9 +647,20 @@ void WiFiInterface::Spin() noexcept rc = SendCommand(NetworkCommand::networkSetHostName, 0, 0, 0, reprap.GetNetwork().GetHostname(), HostNameLength, nullptr, 0); if (rc != ResponseEmpty) { - reprap.GetPlatform().MessageF(NetworkInfoMessage, "Error: Could not set WiFi hostname: %s\n", TranslateWiFiResponse(rc)); + reprap.GetPlatform().MessageF(NetworkErrorMessage, "failed to set WiFi hostname: %s\n", TranslateWiFiResponse(rc)); } - +#if SAME5x + // If running the RTOS-based WiFi module code, tell the module to increase SPI clock speed to 40MHz. + // This is safe on SAME5x processors but not on SAM4 processors. + if (isdigit(wiFiServerVersion[0]) && wiFiServerVersion[0] >= '2') + { + rc = SendCommand(NetworkCommand::networkSetClockControl, 0, 0, 0x2001, nullptr, 0, nullptr, 0); + if (rc != ResponseEmpty) + { + reprap.GetPlatform().MessageF(NetworkErrorMessage, "failed to set WiFi SPI speed: %s\n", TranslateWiFiResponse(rc)); + } + } +#endif SetState(NetworkState::active); espStatusChanged = true; // make sure we fetch the current state and enable the ESP interrupt } @@ -656,7 +668,7 @@ void WiFiInterface::Spin() noexcept { // Something went wrong, maybe a bad firmware image was flashed // Disable the WiFi chip again in this case - platform.MessageF(NetworkInfoMessage, "Error: Failed to initialise WiFi module: %s\n", TranslateWiFiResponse(rc)); + platform.MessageF(NetworkErrorMessage, "failed to initialise WiFi module: %s\n", TranslateWiFiResponse(rc)); Stop(); } } @@ -669,10 +681,12 @@ void WiFiInterface::Spin() noexcept break; case NetworkState::disabled: +#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES if (uploader != nullptr) { uploader->Spin(); } +#endif break; case NetworkState::active: @@ -713,7 +727,7 @@ void WiFiInterface::Spin() noexcept else { Stop(); - platform.MessageF(NetworkInfoMessage, "Failed to change WiFi mode: %s\n", TranslateWiFiResponse(rslt)); + platform.MessageF(NetworkErrorMessage, "failed to change WiFi mode: %s\n", TranslateWiFiResponse(rslt)); } } else if (currentMode == WiFiState::connected || currentMode == WiFiState::runningAsAccessPoint) @@ -1929,11 +1943,11 @@ void WiFiInterface::GetNewStatus() noexcept rcvr.Value().messageBuffer[ARRAY_UPB(rcvr.Value().messageBuffer)] = 0; if (rslt < 0) { - platform.MessageF(NetworkInfoMessage, "Error retrieving WiFi status message: %s\n", TranslateWiFiResponse(rslt)); + platform.MessageF(NetworkErrorMessage, "failed to retrieve WiFi status message: %s\n", TranslateWiFiResponse(rslt)); } else if (rslt > 0 && rcvr.Value().messageBuffer[0] != 0) { - platform.MessageF(NetworkInfoMessage, "WiFi reported error: %s\n", rcvr.Value().messageBuffer); + platform.MessageF(NetworkErrorMessage, "WiFi module reported: %s\n", rcvr.Value().messageBuffer); } } diff --git a/src/Networking/ESP8266WiFi/WifiFirmwareUploader.cpp b/src/Networking/ESP8266WiFi/WifiFirmwareUploader.cpp index 69739e39..d2f5f2a2 100644 --- a/src/Networking/ESP8266WiFi/WifiFirmwareUploader.cpp +++ b/src/Networking/ESP8266WiFi/WifiFirmwareUploader.cpp @@ -7,7 +7,7 @@ #include "WifiFirmwareUploader.h" -#if HAS_WIFI_NETWORKING +#if HAS_WIFI_NETWORKING && (HAS_MASS_STORAGE || HAS_EMBEDDED_FILES) #include "WiFiInterface.h" diff --git a/src/Networking/Network.cpp b/src/Networking/Network.cpp index 415aeea8..45e20058 100644 --- a/src/Networking/Network.cpp +++ b/src/Networking/Network.cpp @@ -87,7 +87,7 @@ Network::Network(Platform& p) noexcept : platform(p) interfaces[0] = new LwipEthernetInterface(p); #elif defined(DUET_NG) || defined(DUET3MINI_V04) interfaces[0] = nullptr; // we set this up in Init() -#elif defined(DUET3MINI4) +#elif defined(FMDC_V02) interfaces[0] = new WiFiInterface(p); #elif defined(DUET_M) interfaces[0] = new W5500Interface(p); diff --git a/src/ObjectModel/ObjectModel.cpp b/src/ObjectModel/ObjectModel.cpp index bef41e8f..215c7414 100644 --- a/src/ObjectModel/ObjectModel.cpp +++ b/src/ObjectModel/ObjectModel.cpp @@ -1042,29 +1042,44 @@ decrease(strlen(idString)) // recursion variant case TypeCode::Bitmap16: case TypeCode::Bitmap32: - if (context.WantArrayLength()) { - if (*idString != 0) + const int numSetBits = Bitmap<uint32_t>::MakeFromRaw(val.uVal).CountSetBits(); + if (context.WantArrayLength()) { - break; - } - const auto bm = Bitmap<uint32_t>::MakeFromRaw(val.uVal); - return ExpressionValue((int32_t)bm.CountSetBits()); - } - if (*idString == '^') - { - ++idString; - if (*idString != 0) - { - break; + if (*idString != 0) + { + break; + } + return ExpressionValue((int32_t)numSetBits); } - if (context.WantExists()) + + if (*idString == '^') { - return ExpressionValue(true); + ++idString; + if (*idString != 0) + { + break; + } + context.AddIndex(); + const bool inBounds = (context.GetLastIndex() >= 0 && context.GetLastIndex() < numSetBits); + if (context.WantExists()) + { + return ExpressionValue(inBounds); + } + + if (!inBounds) + { + throw context.ConstructParseException("array index out of bounds"); + } + + if (context.WantExists()) + { + return ExpressionValue(true); + } + return ExpressionValue((int32_t)(Bitmap<uint32_t>::MakeFromRaw(val.uVal).GetSetBitNumber(context.GetLastIndex()))); } - const auto bm = Bitmap<uint32_t>::MakeFromRaw(val.uVal); - return ExpressionValue((int32_t)bm.GetSetBitNumber(context.GetLastIndex())); } + if (*idString != 0) { break; @@ -1076,29 +1091,45 @@ decrease(strlen(idString)) // recursion variant return ExpressionValue((int32_t)val.uVal); case TypeCode::Bitmap64: - if (context.WantArrayLength()) { - if (*idString != 0) + const int numSetBits = Bitmap<uint64_t>::MakeFromRaw(val.Get56BitValue()).CountSetBits(); + if (context.WantArrayLength()) { - break; - } - const auto bm = Bitmap<uint64_t>::MakeFromRaw(val.Get56BitValue()); - return ExpressionValue((int32_t)bm.CountSetBits()); - } - if (*idString == '^') - { - ++idString; - if (*idString != 0) - { - break; + if (*idString != 0) + { + break; + } + return ExpressionValue((int32_t)numSetBits); } - if (context.WantExists()) + + if (*idString == '^') { - return ExpressionValue(true); + ++idString; + if (*idString != 0) + { + break; + } + context.AddIndex(); + const bool inBounds = (context.GetLastIndex() >= 0 && context.GetLastIndex() < numSetBits); + if (context.WantExists()) + { + return ExpressionValue(inBounds); + } + + if (!inBounds) + { + throw context.ConstructParseException("array index out of bounds"); + } + + if (context.WantExists()) + { + return ExpressionValue(true); + } + + return ExpressionValue((int32_t)(Bitmap<uint64_t>::MakeFromRaw(val.Get56BitValue()).GetSetBitNumber(context.GetLastIndex()))); } - const auto bm = Bitmap<uint64_t>::MakeFromRaw(val.Get56BitValue()); - return ExpressionValue((int32_t)bm.GetSetBitNumber(context.GetLastIndex())); } + if (*idString != 0) { break; diff --git a/src/Platform/MessageType.h b/src/Platform/MessageType.h index 2c4c4b76..d6923294 100644 --- a/src/Platform/MessageType.h +++ b/src/Platform/MessageType.h @@ -48,18 +48,19 @@ enum MessageType : uint32_t LogLevelShift = 30, // How many bits we have to shift a MessageType right by to get the logging level // Common combinations - NoDestinationMessage = 0u, // A message that is going nowhere - GenericMessage = UsbMessage | AuxMessage | HttpMessage | TelnetMessage, // A message that is to be sent to the web, Telnet, USB and panel - LogOff = LogMessageLowBit | LogMessageHighBit, // Log level "off (3): do not log this message - LogWarn = LogMessageHighBit, // Log level "warn" (2): all messages of type Error and Warning are logged - LogInfo = LogMessageLowBit, // Log level "info" (1): all messages of level "warn" plus info messages - LoggedGenericMessage = GenericMessage | LogWarn, // A GenericMessage that is also logged - DirectAuxMessage = AuxMessage | RawMessageFlag, // Direct message to PanelDue - ErrorMessage = GenericMessage | LogWarn | ErrorMessageFlag, // An error message - WarningMessage = GenericMessage | LogWarn | WarningMessageFlag, // A warning message - FirmwareUpdateMessage = UsbMessage | ImmediateAuxMessage, // A message that conveys progress of a firmware update - FirmwareUpdateErrorMessage = FirmwareUpdateMessage | ErrorMessageFlag, // A message that reports an error during a firmware update - NetworkInfoMessage = UsbMessage | AuxMessage | LogWarn // A message that conveys information about the state of the network interface + NoDestinationMessage = 0u, // A message that is going nowhere + GenericMessage = UsbMessage | AuxMessage | HttpMessage | TelnetMessage, // A message that is to be sent to the web, Telnet, USB and panel + LogOff = LogMessageLowBit | LogMessageHighBit, // Log level "off (3): do not log this message + LogWarn = LogMessageHighBit, // Log level "warn" (2): all messages of type Error and Warning are logged + LogInfo = LogMessageLowBit, // Log level "info" (1): all messages of level "warn" plus info messages + LoggedGenericMessage = GenericMessage | LogWarn, // A GenericMessage that is also logged + DirectAuxMessage = AuxMessage | RawMessageFlag, // Direct message to PanelDue + ErrorMessage = GenericMessage | LogWarn | ErrorMessageFlag, // An error message + WarningMessage = GenericMessage | LogWarn | WarningMessageFlag, // A warning message + FirmwareUpdateMessage = UsbMessage | ImmediateAuxMessage, // A message that conveys progress of a firmware update + FirmwareUpdateErrorMessage = FirmwareUpdateMessage | ErrorMessageFlag, // A message that reports an error during a firmware update + NetworkInfoMessage = UsbMessage | AuxMessage | LogWarn, // A message that conveys information about the state of the network interface + NetworkErrorMessage = UsbMessage | AuxMessage | LogWarn | ErrorMessageFlag // A message that conveys information about the state of the network interface }; inline constexpr MessageType AddLogDebug(MessageType mt) noexcept diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 67df3ded..ff1e6db6 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -3803,8 +3803,8 @@ void Platform::SetBoardType(BoardType bt) noexcept board = (digitalRead(DIRECTION_PINS[0])) ? BoardType::Duet3_6HC_v101 : BoardType::Duet3_6HC_v06_100; #elif defined(DUET3_MB6XD) board = BoardType::Duet3_6XD; -#elif defined(DUET3MINI4) - board = BoardType::Duet3Mini4; +#elif defined(FMDC_V02) + board = BoardType::FMDC; #elif defined(SAME70XPLD) board = BoardType::SAME70XPLD_0; #elif defined(DUET_NG) @@ -3879,12 +3879,12 @@ const char *_ecv_array Platform::GetElectronicsString() const noexcept case BoardType::Duet3Mini_WiFi: return "Duet 3 " BOARD_SHORT_NAME " WiFi"; case BoardType::Duet3Mini_Ethernet: return "Duet 3 " BOARD_SHORT_NAME " Ethernet"; #elif defined(DUET3_MB6HC) - case BoardType::Duet3_6HC_v06_100: return "Duet 3 " BOARD_SHORT_NAME " v0.6 or 1.0"; - case BoardType::Duet3_6HC_v101: return "Duet 3 " BOARD_SHORT_NAME " v1.01 or later"; + case BoardType::Duet3_6HC_v06_100: return "Duet 3 " BOARD_SHORT_NAME " v0.6 or 1.0"; + case BoardType::Duet3_6HC_v101: return "Duet 3 " BOARD_SHORT_NAME " v1.01 or later"; #elif defined(DUET3_MB6XD) case BoardType::Duet3_6XD: return "Duet 3 " BOARD_SHORT_NAME; // we have only one version at present -#elif defined(DUET3MINI4) - case BoardType::Duet3Mini4: return "Duet 3 " BOARD_SHORT_NAME; +#elif defined(FMDC_V02) + case BoardType::FMDC: return "Duet 3 " BOARD_SHORT_NAME; #elif defined(SAME70XPLD) case BoardType::SAME70XPLD_0: return "SAME70-XPLD"; #elif defined(DUET_NG) @@ -3918,12 +3918,12 @@ const char *_ecv_array Platform::GetBoardString() const noexcept case BoardType::Duet3Mini_WiFi: return "duet5lcwifi"; case BoardType::Duet3Mini_Ethernet: return "duet5lcethernet"; #elif defined(DUET3_MB6HC) - case BoardType::Duet3_6HC_v06_100: return "duet3mb6hc100"; - case BoardType::Duet3_6HC_v101: return "duet3mb6hc101"; + case BoardType::Duet3_6HC_v06_100: return "duet3mb6hc100"; + case BoardType::Duet3_6HC_v101: return "duet3mb6hc101"; #elif defined(DUET3_MB6XD) case BoardType::Duet3_6XD: return "duet3mb6xd"; // we have only one version at present -#elif defined(DUET3MINI4) - case BoardType::Duet3Mini4: return "duet3mini4"; +#elif defined(FMDC_V02) + case BoardType::FMDC: return "fmdc"; #elif defined(SAME70XPLD) case BoardType::SAME70XPLD_0: return "same70xpld"; #elif defined(DUET_NG) diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index b27a626c..960a3406 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -128,8 +128,8 @@ enum class BoardType : uint8_t Duet3_6HC_v101 = 2, #elif defined(DUET3_MB6XD) Duet3_6XD = 1, -#elif defined(DUET3MINI4) - Duet3Mini4, +#elif defined(FMDC_V02) + FMDC, #elif defined(SAME70XPLD) SAME70XPLD_0 = 1 #elif defined(DUET_NG) @@ -415,7 +415,7 @@ public: bool FileExists(const char *_ecv_array folder, const char *_ecv_array filename) const noexcept; # if HAS_MASS_STORAGE || HAS_SBC_INTERFACE bool Delete(const char *_ecv_array folder, const char *_ecv_array filename) const noexcept; -#endif +# endif static const char *_ecv_array GetWebDir() noexcept; // Where the html etc files are static const char *_ecv_array GetGCodeDir() noexcept; // Where the gcodes are diff --git a/src/Platform/RepRap.cpp b/src/Platform/RepRap.cpp index 10f21723..286e63a8 100644 --- a/src/Platform/RepRap.cpp +++ b/src/Platform/RepRap.cpp @@ -344,11 +344,11 @@ constexpr ObjectModelTableEntry RepRap::objectModelTable[] = { "macroRestarted", OBJECT_MODEL_FUNC(self->gCodes->GetMacroRestarted()), ObjectModelEntryFlags::none }, { "messageBox", OBJECT_MODEL_FUNC_IF(self->mbox.active, self, 5), ObjectModelEntryFlags::important }, { "msUpTime", OBJECT_MODEL_FUNC_NOSELF((int32_t)(context.GetStartMillis() % 1000u)), ObjectModelEntryFlags::live }, - { "nextTool", OBJECT_MODEL_FUNC((int32_t)self->gCodes->GetNewToolNumber()), ObjectModelEntryFlags::live }, + { "nextTool", OBJECT_MODEL_FUNC((int32_t)self->gCodes->GetNewToolNumber()), ObjectModelEntryFlags::none }, #if HAS_VOLTAGE_MONITOR { "powerFailScript", OBJECT_MODEL_FUNC(self->gCodes->GetPowerFailScript()), ObjectModelEntryFlags::none }, #endif - { "previousTool", OBJECT_MODEL_FUNC((int32_t)self->previousToolNumber), ObjectModelEntryFlags::live }, + { "previousTool", OBJECT_MODEL_FUNC((int32_t)self->previousToolNumber), ObjectModelEntryFlags::none }, { "restorePoints", OBJECT_MODEL_FUNC_NOSELF(&restorePointsArrayDescriptor), ObjectModelEntryFlags::none }, { "status", OBJECT_MODEL_FUNC(self->GetStatusString()), ObjectModelEntryFlags::live }, { "thisInput", OBJECT_MODEL_FUNC_IF_NOSELF(context.GetGCodeBuffer() != nullptr, (int32_t)context.GetGCodeBuffer()->GetChannel().ToBaseType()), ObjectModelEntryFlags::verbose }, @@ -1118,7 +1118,7 @@ void RepRap::PrintTool(int toolNumber, const StringRef& reply) const noexcept ReadLockedPointer<Tool> const tool = GetTool(toolNumber); if (tool.IsNotNull()) { - tool->Print(reply); + tool->PrintTool(reply); } else { @@ -2077,7 +2077,13 @@ OutputBuffer *RepRap::GetLegacyStatusResponse(uint8_t type, int seq) const noexc { // Add the static fields response->catf(",\"geometry\":\"%s\",\"axes\":%u,\"totalAxes\":%u,\"axisNames\":\"%s\",\"volumes\":%u,\"numTools\":%u,\"myName\":\"%.s\",\"firmwareName\":\"%.s\"", - move->GetGeometryString(), numVisibleAxes, gCodes->GetTotalAxes(), gCodes->GetAxisLetters(), MassStorage::GetNumVolumes(), GetNumberOfContiguousTools(), myName.c_str(), FIRMWARE_NAME); + move->GetGeometryString(), numVisibleAxes, gCodes->GetTotalAxes(), gCodes->GetAxisLetters(), +#if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES + MassStorage::GetNumVolumes(), +#else + 0, +#endif + GetNumberOfContiguousTools(), myName.c_str(), FIRMWARE_NAME); } response->cat("}\n"); // include a newline to help PanelDue resync diff --git a/src/RepRapFirmware.pdp b/src/RepRapFirmware.pdp Binary files differindex 9c58837f..e62c1654 100644 --- a/src/RepRapFirmware.pdp +++ b/src/RepRapFirmware.pdp diff --git a/src/Storage/FileData.h b/src/Storage/FileData.h index 12e22ae9..8cb4d0f3 100644 --- a/src/Storage/FileData.h +++ b/src/Storage/FileData.h @@ -10,6 +10,8 @@ #include "FileStore.h" +#if HAS_MASS_STORAGE || HAS_SBC_INTERFACE || HAS_EMBEDDED_FILES + class FileGCodeInput; // Small class to hold an open file and data relating to it. @@ -167,3 +169,5 @@ private: }; #endif + +#endif diff --git a/src/Tools/Tool.cpp b/src/Tools/Tool.cpp index 03f03071..2ff8f43b 100644 --- a/src/Tools/Tool.cpp +++ b/src/Tools/Tool.cpp @@ -279,7 +279,7 @@ DEFINE_GET_OBJECT_MODEL_TABLE(Tool) return (tool == nullptr) ? 0.0 : tool->offset[axis]; } -void Tool::Print(const StringRef& reply) const noexcept +void Tool::PrintTool(const StringRef& reply) const noexcept { reply.printf("Tool %u - ", myNumber); if (name != nullptr) diff --git a/src/Tools/Tool.h b/src/Tools/Tool.h index db86ffc6..0804f72b 100644 --- a/src/Tools/Tool.h +++ b/src/Tools/Tool.h @@ -77,7 +77,7 @@ public: int Number() const noexcept; void DefineMix(const float m[]) noexcept; const float *_ecv_array GetMix() const noexcept; - void Print(const StringRef& reply) const noexcept; + void PrintTool(const StringRef& reply) const noexcept; AxesBitmap GetXAxisMap() const noexcept { return axisMapping[0]; } AxesBitmap GetYAxisMap() const noexcept { return axisMapping[1]; } FansBitmap GetFanMapping() const noexcept { return fanMapping; } diff --git a/src/Version.h b/src/Version.h index 268bad38..474912db 100644 --- a/src/Version.h +++ b/src/Version.h @@ -10,7 +10,7 @@ #ifndef VERSION // Note: the complete VERSION string must be in standard version number format and must not contain spaces! This is so that DWC can parse it. -# define MAIN_VERSION "3.4.1beta1" +# define MAIN_VERSION "3.4.0+1" # ifdef USE_CAN0 # define VERSION_SUFFIX "(CAN0)" # else diff --git a/src/bossa/Flasher.cpp b/src/bossa/Flasher.cpp index 0a6ec978..4b611874 100644 --- a/src/bossa/Flasher.cpp +++ b/src/bossa/Flasher.cpp @@ -28,6 +28,10 @@ /////////////////////////////////////////////////////////////////////////////// #include "Flasher.h" +#include <RepRapFirmware.h> + +#if SUPPORT_PANELDUE_FLASH + #include <Platform/RepRap.h> #include <Platform/Platform.h> #include <General/Vector.hpp> @@ -199,4 +203,6 @@ void Flasher::lock(/* string& regionArg, */ bool enable) THROWS(GCodeException) #endif } +#endif + // End |