diff options
author | David Crocker <dcrocker@eschertech.com> | 2017-09-24 11:44:59 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2017-09-24 11:45:16 +0300 |
commit | 8c087526c3abec8ae7552291465062bce4c1ead8 (patch) | |
tree | 874d1419a09dfd8e75588bb5145a44723a5653e8 /src | |
parent | a8a4d14009f2877d4e76fc7b2e23b15629db2ca6 (diff) |
Version 1.20alpha4
We now create a resurrect.g file any time the print is paused
Introduced new feature #defines and a DUET_06_085 define to simplify
conditoinals that depend on the target board
Diffstat (limited to 'src')
30 files changed, 182 insertions, 203 deletions
diff --git a/src/Alligator/Pins_Alligator.h b/src/Alligator/Pins_Alligator.h index 38e613dc..d8eb673b 100644 --- a/src/Alligator/Pins_Alligator.h +++ b/src/Alligator/Pins_Alligator.h @@ -3,6 +3,11 @@ #define FIRMWARE_NAME "RepRapFirmware for Alligator" +// Features definition +#define HAS_LWIP_NETWORKING 1 +#define HAS_CPU_TEMP_SENSOR 1 +#define HAS_HIGH_SPEED_SD 0 + const size_t NumFirmwareUpdateModules = 1; #define IAP_UPDATE_FILE "iapalligator.bin" #define IAP_FIRMWARE_FILE "RepRapFirmware-Alligator.bin" diff --git a/src/Duet/Pins_Duet.h b/src/Duet/Pins_Duet.h index ce806395..768f686e 100644 --- a/src/Duet/Pins_Duet.h +++ b/src/Duet/Pins_Duet.h @@ -3,6 +3,11 @@ #define FIRMWARE_NAME "RepRapFirmware for Duet" +// Features definition +#define HAS_LWIP_NETWORKING 1 +#define HAS_CPU_TEMP_SENSOR 1 +#define HAS_HIGH_SPEED_SD 1 + const size_t NumFirmwareUpdateModules = 1; #define IAP_UPDATE_FILE "iap.bin" #define IAP_FIRMWARE_FILE "RepRapFirmware.bin" diff --git a/src/DuetNG/Pins_DuetNG.h b/src/DuetNG/Pins_DuetNG.h index 445950c8..8c285abc 100644 --- a/src/DuetNG/Pins_DuetNG.h +++ b/src/DuetNG/Pins_DuetNG.h @@ -21,7 +21,12 @@ const size_t NumFirmwareUpdateModules = 1; // 1 module # error Firmware name not defined #endif -#define IAP_UPDATE_FILE "iap4e.bin" // hoping eventually to use the same IAP file for both Duet WiFi and Duet Ethernet +// Features definition +#define HAS_LWIP_NETWORKING 0 +#define HAS_CPU_TEMP_SENSOR 1 +#define HAS_HIGH_SPEED_SD 1 + +#define IAP_UPDATE_FILE "iap4e.bin" // using the same IAP file for both Duet WiFi and Duet Ethernet #define SUPPORT_INKJET 0 // set nonzero to support inkjet control #define SUPPORT_ROLAND 0 // set nonzero to support Roland mill diff --git a/src/Fan.cpp b/src/Fan.cpp index b2dcf7ee..46abc2ee 100644 --- a/src/Fan.cpp +++ b/src/Fan.cpp @@ -319,8 +319,6 @@ void Fan::Disable() pin = NoPin; } -#ifdef DUET_NG - // Save the settings of this fan if it isn't thermostatic bool Fan::WriteSettings(FileStore *f, size_t fanNum) const { @@ -335,6 +333,4 @@ bool Fan::WriteSettings(FileStore *f, size_t fanNum) const return true; } -#endif - // End @@ -30,10 +30,7 @@ public: void SetHeatersMonitored(uint16_t h); void Check(); void Disable(); - -#ifdef DUET_NG bool WriteSettings(FileStore *f, size_t fanNum) const; // Save the settings of this fan if it isn't thermostatic -#endif private: typedef uint32_t HeatersMonitoredBitmap; // needs to be wide enough for 8 real heaters + 10 virtual heaters diff --git a/src/GCodes/GCodes.cpp b/src/GCodes/GCodes.cpp index ff98f249..a576a26d 100644 --- a/src/GCodes/GCodes.cpp +++ b/src/GCodes/GCodes.cpp @@ -177,7 +177,7 @@ void GCodes::Reset() simulationTime = 0.0; isPaused = false; #ifdef DUET_NG - isAutoPaused = resumeInfoSaved = false; + isAutoPaused = false; #endif doingToolChange = false; doingManualBedProbe = false; @@ -1453,12 +1453,13 @@ void GCodes::DoPause(GCodeBuffer& gb, bool isAuto) } SaveFanSpeeds(); + SaveResumeInfo(); // create the resume file so that we can resume after power down + gb.SetState(GCodeState::pausing1); isPaused = true; #ifdef DUET_NG isAutoPaused = isAuto; - resumeInfoSaved = false; #endif } @@ -1494,14 +1495,7 @@ bool GCodes::AutoPause() return false; } - if (isPaused) - { - if (!resumeInfoSaved) - { - SaveResumeInfo(); - } - } - else if (reprap.GetPrintMonitor().IsPrinting()) + if (!isPaused && reprap.GetPrintMonitor().IsPrinting()) { if (!LockMovement(*autoPauseGCode)) { @@ -1509,7 +1503,6 @@ bool GCodes::AutoPause() } reprap.GetHeat().SuspendHeaters(true); // turn heaters off to conserve power for the motors to execute the pause DoPause(*autoPauseGCode, true); - SaveResumeInfo(); } return true; } @@ -1551,6 +1544,7 @@ bool GCodes::AutoResumeAfterShutdown() // Currently we don't do anything here return true; } +#endif void GCodes::SaveResumeInfo() { @@ -1621,7 +1615,11 @@ void GCodes::SaveResumeInfo() { buf.catf(" %c%.2f", axisLetters[axis], (double)pauseRestorePoint.moveCoords[axis]); } - buf.catf("\nG1 F%.1f P%u\nM24\n", (double)(pauseRestorePoint.feedRate * MinutesToSeconds), (unsigned int)pauseRestorePoint.ioBits); + buf.catf("\nG1 F%.1f", (double)(pauseRestorePoint.feedRate * MinutesToSeconds)); +#if SUPPORT_IOBITS + buf.catf(" P%u", (unsigned int)pauseRestorePoint.ioBits); +#endif + buf.cat("\nM24\n"); ok = f->Write(buf.Pointer()); // restore feed rate and output bits } if (!f->Close()) @@ -1638,13 +1636,9 @@ void GCodes::SaveResumeInfo() platform.MessageF(ErrorMessage, "Failed to write or close file %s\n", RESUME_AFTER_POWER_FAIL_G); } } - - resumeInfoSaved = true; // say we saved it even if there was an error, to avoid constant retrying } } -#endif - void GCodes::Diagnostics(MessageType mtype) { platform.Message(mtype, "=== GCodes ===\n"); @@ -2873,12 +2867,6 @@ bool GCodes::QueueFileToPrint(const char* fileName, StringRef& reply) FileStore * const f = platform.GetFileStore(platform.GetGCodeDir(), fileName, OpenMode::read); if (f != nullptr) { - // Cancel current print if there is any - if (!reprap.GetPrintMonitor().IsPrinting()) - { - CancelPrint(false, true); - } - fileGCode->SetToolNumberAdjust(0); // clear tool number adjustment fileGCode->MachineState().volumetricExtrusion = false; // default to non-volumetric extrusion diff --git a/src/GCodes/GCodes.h b/src/GCodes/GCodes.h index d6ca8e1f..e3806556 100644 --- a/src/GCodes/GCodes.h +++ b/src/GCodes/GCodes.h @@ -271,9 +271,7 @@ private: void EndSimulation(GCodeBuffer *gb); // Restore positions etc. when exiting simulation mode bool IsCodeQueueIdle() const; // Return true if the code queue is idle -#ifdef DUET_NG void SaveResumeInfo(); -#endif Platform& platform; // The RepRap machine @@ -306,7 +304,6 @@ private: bool pausePending; // true if we have been asked to pause but we are running a macro #ifdef DUET_NG bool isAutoPaused; // true if the print was paused automatically - bool resumeInfoSaved; // true if we have saved resume info at this pause point #endif bool runningConfigFile; // We are running config.g during the startup process bool doingToolChange; // We are running tool change macros @@ -438,9 +435,10 @@ private: #ifdef DUET_NG static constexpr const char* POWER_FAIL_G = "powerfail.g"; static constexpr const char* POWER_RESTORE_G = "powerrestore.g"; - static constexpr const char* RESUME_AFTER_POWER_FAIL_G = "resurrect.g"; #endif + static constexpr const char* RESUME_AFTER_POWER_FAIL_G = "resurrect.g"; + static constexpr const float MinServoPulseWidth = 544.0, MaxServoPulseWidth = 2400.0; static const uint16_t ServoRefreshFrequency = 50; }; diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index d1c39254..487073d2 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -272,7 +272,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, StringRef& reply) } { bool wasPaused = isPaused; // isPaused gets cleared by CancelPrint - CancelPrint(true, true); + CancelPrint(true, &gb == fileGCode); // if this is normal end-of-print commanded by the file, deleted the ressurrect.g file if (wasPaused) { reply.copy("Print cancelled"); diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp index f6f8ad04..841f79b4 100644 --- a/src/Heating/Heat.cpp +++ b/src/Heating/Heat.cpp @@ -79,7 +79,7 @@ void Heat::Init() { pids[heater]->Init(DefaultBedHeaterGain, DefaultBedHeaterTimeConstant, DefaultBedHeaterDeadTime, DefaultBedTemperatureLimit, false); } -#if !defined(DUET_NG) && !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if defined(DUET_06_085) else if (heater == Heaters - 1) { // On the Duet 085, the heater 6 pin is also the fan 1 pin. By default we support fan 1, so disable heater 6. @@ -101,7 +101,7 @@ void Heat::Init() } // Set up default virtual heaters for MCU temperature and TMC driver overheat sensors -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR virtualHeaterSensors[0] = TemperatureSensor::Create(CpuTemperatureSenseChannel); virtualHeaterSensors[0]->SetHeaterName("MCU"); // name this virtual heater so that it appears in DWC #endif @@ -499,6 +499,8 @@ void Heat::SuspendHeaters(bool sus) } } +#endif + // Save some resume information returning true if successful. // We assume that the bed and chamber heaters are either on and active, or off (not on standby). bool Heat::WriteBedAndChamberTempSettings(FileStore *f) const @@ -516,6 +518,4 @@ bool Heat::WriteBedAndChamberTempSettings(FileStore *f) const return (buf.Length() == 0) || f->Write(buf.Pointer()); } -#endif - // End diff --git a/src/Heating/Heat.h b/src/Heating/Heat.h index 3f38c1a4..cfa81fc4 100644 --- a/src/Heating/Heat.h +++ b/src/Heating/Heat.h @@ -128,9 +128,10 @@ public: return lastStandbyTools[heater]; } + bool WriteBedAndChamberTempSettings(FileStore *f) const; // Save some resume information + #ifdef DUET_NG void SuspendHeaters(bool sus); // Suspend the heaters to conserve power - bool WriteBedAndChamberTempSettings(FileStore *f) const; // Save some resume information #endif private: diff --git a/src/Heating/Pid.cpp b/src/Heating/Pid.cpp index 30bb07df..e64c373d 100644 --- a/src/Heating/Pid.cpp +++ b/src/Heating/Pid.cpp @@ -86,7 +86,7 @@ bool PID::SetModel(float gain, float tc, float td, float maxPwm, bool usePid) const bool rslt = model.SetParameters(gain, tc, td, maxPwm, temperatureLimit, usePid); if (rslt) { -#if !defined(DUET_NG) && !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if defined(DUET_06_085) if (heater == Heaters - 1) { // The last heater on the Duet 0.8.5 + DueX4 shares its pin with Fan1 diff --git a/src/Heating/Sensors/CpuTemperatureSensor.cpp b/src/Heating/Sensors/CpuTemperatureSensor.cpp index 85ff00ba..f40d1f69 100644 --- a/src/Heating/Sensors/CpuTemperatureSensor.cpp +++ b/src/Heating/Sensors/CpuTemperatureSensor.cpp @@ -9,7 +9,7 @@ #include "Platform.h" #include "RepRap.h" -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR CpuTemperatureSensor::CpuTemperatureSensor(unsigned int channel) : TemperatureSensor(channel, "microcontroller embedded temperature sensor") { diff --git a/src/Heating/Sensors/CpuTemperatureSensor.h b/src/Heating/Sensors/CpuTemperatureSensor.h index 7e23ac77..2c935dcd 100644 --- a/src/Heating/Sensors/CpuTemperatureSensor.h +++ b/src/Heating/Sensors/CpuTemperatureSensor.h @@ -10,7 +10,7 @@ #include "TemperatureSensor.h" -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR class CpuTemperatureSensor : public TemperatureSensor { diff --git a/src/Heating/Sensors/TemperatureSensor.cpp b/src/Heating/Sensors/TemperatureSensor.cpp index 401bbb7e..1314d911 100644 --- a/src/Heating/Sensors/TemperatureSensor.cpp +++ b/src/Heating/Sensors/TemperatureSensor.cpp @@ -6,7 +6,7 @@ #include "RtdSensor31865.h" #include "GCodes/GCodeBuffer.h" -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR #include "CpuTemperatureSensor.h" #endif @@ -102,7 +102,7 @@ TemperatureSensor *TemperatureSensor::Create(unsigned int channel) { ts = new CurrentLoopTemperatureSensor(channel); } -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR else if (channel == CpuTemperatureSenseChannel) { ts = new CpuTemperatureSensor(channel); diff --git a/src/Movement/Kinematics/Kinematics.h b/src/Movement/Kinematics/Kinematics.h index 91ec36e0..8dfe3da6 100644 --- a/src/Movement/Kinematics/Kinematics.h +++ b/src/Movement/Kinematics/Kinematics.h @@ -146,10 +146,8 @@ public: // This default is good for Cartesian and Core printers, but not deltas or SCARA virtual AxesBitmap AxesAssumedHomed(AxesBitmap g92Axes) const { return g92Axes; } -#ifdef DUET_NG // Write any calibration data that we need to resume a print after power fail, returning true if successful. Override where necessary. virtual bool WriteResumeSettings(FileStore *f) const { return true; } -#endif // Override this virtual destructor if your constructor allocates any dynamic memory virtual ~Kinematics() { } diff --git a/src/Movement/Kinematics/LinearDeltaKinematics.cpp b/src/Movement/Kinematics/LinearDeltaKinematics.cpp index e65a2fee..316c0ef6 100644 --- a/src/Movement/Kinematics/LinearDeltaKinematics.cpp +++ b/src/Movement/Kinematics/LinearDeltaKinematics.cpp @@ -565,16 +565,12 @@ bool LinearDeltaKinematics::WriteCalibrationParameters(FileStore *f) const return ok; } -#ifdef DUET_NG - // Write any calibration data that we need to resume a print after power fail, returning true if successful bool LinearDeltaKinematics::WriteResumeSettings(FileStore *f) const { return !doneAutoCalibration || WriteCalibrationParameters(f); } -#endif - // Get the bed tilt fraction for the specified axis float LinearDeltaKinematics::GetTiltCorrection(size_t axis) const { diff --git a/src/Movement/Kinematics/LinearDeltaKinematics.h b/src/Movement/Kinematics/LinearDeltaKinematics.h index df10a1b1..875bd126 100644 --- a/src/Movement/Kinematics/LinearDeltaKinematics.h +++ b/src/Movement/Kinematics/LinearDeltaKinematics.h @@ -44,10 +44,7 @@ public: const char* GetHomingFileName(AxesBitmap toBeHomed, AxesBitmap alreadyHomed, size_t numVisibleAxes, AxesBitmap& mustHomeFirst) const override; bool QueryTerminateHomingMove(size_t axis) const override; void OnHomingSwitchTriggered(size_t axis, bool highEnd, const float stepsPerMm[], DDA& dda) const override; - -#ifdef DUET_NG bool WriteResumeSettings(FileStore *f) const override; -#endif // Public functions specific to this class float GetDiagonalSquared() const { return D2; } diff --git a/src/Movement/Kinematics/ZLeadscrewKinematics.cpp b/src/Movement/Kinematics/ZLeadscrewKinematics.cpp index 328d208b..0e4e38e4 100644 --- a/src/Movement/Kinematics/ZLeadscrewKinematics.cpp +++ b/src/Movement/Kinematics/ZLeadscrewKinematics.cpp @@ -318,8 +318,6 @@ void ZLeadscrewKinematics::AppendCorrections(const floatc_t corrections[], Strin } } -#ifdef DUET_NG - // Write any calibration data that we need to resume a print after power fail, returning true if successful bool ZLeadscrewKinematics::WriteResumeSettings(FileStore *f) const { @@ -327,6 +325,4 @@ bool ZLeadscrewKinematics::WriteResumeSettings(FileStore *f) const return true; } -#endif - // End diff --git a/src/Movement/Kinematics/ZLeadscrewKinematics.h b/src/Movement/Kinematics/ZLeadscrewKinematics.h index a6caa4a5..e5f8b318 100644 --- a/src/Movement/Kinematics/ZLeadscrewKinematics.h +++ b/src/Movement/Kinematics/ZLeadscrewKinematics.h @@ -21,10 +21,7 @@ public: bool Configure(unsigned int mCode, GCodeBuffer& gb, StringRef& reply, bool& error) override; bool SupportsAutoCalibration() const override; bool DoAutoCalibration(size_t numFactors, const RandomProbePointSet& probePoints, StringRef& reply) override; - -#ifdef DUET_NG bool WriteResumeSettings(FileStore *f) const override; -#endif private: void AppendCorrections(const floatc_t corrections[], StringRef& reply) const; diff --git a/src/Movement/Move.cpp b/src/Movement/Move.cpp index d8e594f7..31890527 100644 --- a/src/Movement/Move.cpp +++ b/src/Movement/Move.cpp @@ -1112,8 +1112,6 @@ void Move::SetIdleTimeout(float timeout) idleTimeout = (uint32_t)lrintf(timeout * 1000.0); } -#ifdef DUET_NG - // Write settings for resuming the print // The GCodes module deals with the head position so all we need worry about is the bed compensation // We don't handle random probe point bed compensation, and we assume that if a height map is being used it is the default one. @@ -1122,8 +1120,6 @@ bool Move::WriteResumeSettings(FileStore *f) const return kinematics->WriteResumeSettings(f) && (!usingMesh || f->Write("G29 S1\n")); } -#endif - // For debugging void Move::PrintCurrentDda() const { diff --git a/src/Movement/Move.h b/src/Movement/Move.h index 68273194..07d00845 100644 --- a/src/Movement/Move.h +++ b/src/Movement/Move.h @@ -116,9 +116,7 @@ public: int32_t GetAccumulatedExtrusion(size_t extruder); // Return ands reset the accumulated extrusion amount -#ifdef DUET_NG bool WriteResumeSettings(FileStore *f) const; // Write settings for resuming the print -#endif static int32_t MotorEndPointToMachine(size_t drive, float coord); // Convert a single motor position to number of steps static float MotorEndpointToPosition(int32_t endpoint, size_t drive); // Convert number of motor steps to motor position diff --git a/src/Platform.cpp b/src/Platform.cpp index f2d244f7..7cc7519e 100644 --- a/src/Platform.cpp +++ b/src/Platform.cpp @@ -48,6 +48,10 @@ extern char _end; extern "C" char *sbrk(int i); +#if !defined(HAS_LWIP_NETWORKING) || !defined(HAS_CPU_TEMP_SENSOR) || !defined(HAS_HIGH_SPEED_SD) +# error Missing feature definition +#endif + #ifdef DUET_NG inline constexpr float AdcReadingToPowerVoltage(uint16_t adcVal) @@ -354,7 +358,7 @@ void Platform::Init() fileStructureInitialised = true; -#if !defined(DUET_NG) && !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if defined(DUET_06_085) mcpDuet.begin(); // only call begin once in the entire execution, this begins the I2C comms on that channel for all objects mcpExpansion.setMCP4461Address(0x2E); // not required for mcpDuet, as this uses the default address #endif @@ -387,7 +391,7 @@ void Platform::Init() ARRAY_INIT(instantDvs, INSTANT_DVS); maxPrintingAcceleration = maxTravelAcceleration = 10000.0; -#if !defined(DUET_NG) && !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if defined(DUET_06_085) // Motor current setting on Duet 0.6 and 0.8.5 ARRAY_INIT(potWipes, POT_WIPES); senseResistor = SENSE_RESISTOR; @@ -441,12 +445,12 @@ void Platform::Init() axisDrivers[drive].numDrivers = 1; axisDrivers[drive].driverNumbers[0] = (uint8_t)drive; endStopType[drive] = -#if defined(DUET_NG) || defined(__RADDS__) || defined(__ALLIGATOR__) - EndStopType::lowEndStop; // default to low endstop -#else +#if defined(DUET_06_085) (drive == Y_AXIS) ? EndStopType::lowEndStop // for Ormerod 2/Huxley/Mendel compatibility : EndStopType::noEndStop; // for Ormerod/Huxley/Mendel compatibility +#else + EndStopType::lowEndStop; // default to low endstop #endif endStopLogicLevel[drive] = true; // assume all endstops use active high logic e.g. normally-closed switch to ground } @@ -541,10 +545,10 @@ void Platform::Init() extrusionAncilliaryPwmLogicalPin = Fan0LogicalPin; extrusionAncilliaryPwmFirmwarePin = COOLING_FAN_PINS[0]; extrusionAncilliaryPwmInvert = -#if defined(DUET_NG) || defined(__RADDS__) || defined(__ALLIGATOR__) - false; -#else +#ifdef DUET_06_085 (board == BoardType::Duet_06 || board == BoardType::Duet_07); +#else + false; #endif ARRAY_INIT(tempSensePins, TEMP_SENSE_PINS); ARRAY_INIT(heatOnPins, HEAT_ON_PINS); @@ -573,7 +577,7 @@ void Platform::Init() thermistorFilters[heater].Init(0); } -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR cpuTemperatureFilter.Init(0); #endif @@ -610,8 +614,8 @@ void Platform::Init() } #endif - // MCU temperature monitoring - doesn't work in RADDS due to pin assignments and SAM3X chip bug -#ifndef __RADDS__ + // MCU temperature monitoring +#if HAS_CPU_TEMP_SENSOR temperatureAdcChannel = GetTemperatureAdcChannel(); AnalogInEnableChannel(temperatureAdcChannel, true); highestMcuTemperature = 0; // the highest output we have seen from the ADC filter @@ -669,10 +673,10 @@ void Platform::InitZProbe() zProbeOnFilter.Init(0); zProbeOffFilter.Init(0); -#if defined(DUET_NG) || defined(__RADDS__) || defined(__ALLIGATOR__) - zProbeModulationPin = Z_PROBE_MOD_PIN; -#else +#ifdef DUET_06_085 zProbeModulationPin = (board == BoardType::Duet_07 || board == BoardType::Duet_085) ? Z_PROBE_MOD_PIN07 : Z_PROBE_MOD_PIN; +#else + zProbeModulationPin = Z_PROBE_MOD_PIN; #endif switch (zProbeType) @@ -1313,7 +1317,7 @@ void Platform::Spin() (void)FlushMessages(); // Check the MCU max and min temperatures -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR if (cpuTemperatureFilter.IsValid()) { const uint32_t currentMcuTemperature = cpuTemperatureFilter.GetSum(); @@ -1585,6 +1589,8 @@ bool Platform::ConfigureAutoSave(GCodeBuffer& gb, StringRef& reply) return false; } +#endif + // Save some resume information bool Platform::WriteFanSettings(FileStore *f) const { @@ -1596,14 +1602,12 @@ bool Platform::WriteFanSettings(FileStore *f) const return ok; } -#endif - float Platform::AdcReadingToCpuTemperature(uint32_t adcVal) const { float voltage = (float)adcVal * (3.3/(float)(4096 * ThermistorAverageReadings)); -#ifdef DUET_NG +#if SAM4E return (voltage - 1.44) * (1000.0/4.7) + 27.0 + mcuTemperatureAdjust; // accuracy at 27C is +/-13C -#else +#elif SAM3XA return (voltage - 0.8) * (1000.0/2.65) + 27.0 + mcuTemperatureAdjust; // accuracy at 27C is +/-45C #endif } @@ -1625,7 +1629,7 @@ void Platform::SoftwareReset(uint16_t reason, const uint32_t *stk) { reason |= (uint16_t)SoftwareResetReason::inUsbOutput; // if we are resetting because we are stuck in a Spin function, record whether we are trying to send to USB } -#if !defined(DUET_NG) && !defined(__RADDS__) +#if HAS_LWIP_NETWORKING if (reprap.GetNetwork().InLwip()) { reason |= (uint16_t)SoftwareResetReason::inLwipSpin; @@ -1647,7 +1651,7 @@ void Platform::SoftwareReset(uint16_t reason, const uint32_t *stk) size_t slot = SoftwareResetData::numberOfSlots; SoftwareResetData srdBuf[SoftwareResetData::numberOfSlots]; -#ifdef DUET_NG +#if SAM4E if (flash_read_user_signature(reinterpret_cast<uint32_t*>(srdBuf), sizeof(srdBuf)/sizeof(uint32_t)) == FLASH_RC_OK) #else DueFlashStorage::read(SoftwareResetData::nvAddress, srdBuf, sizeof(srdBuf)); @@ -1662,7 +1666,7 @@ void Platform::SoftwareReset(uint16_t reason, const uint32_t *stk) if (slot == SoftwareResetData::numberOfSlots) { // No free slots, so erase the area -#ifdef DUET_NG +#if SAM4E flash_erase_user_signature(); #endif memset(srdBuf, 0xFF, sizeof(srdBuf)); @@ -1685,7 +1689,7 @@ void Platform::SoftwareReset(uint16_t reason, const uint32_t *stk) } // Save diagnostics data to Flash -#ifdef DUET_NG +#if SAM4E flash_write_user_signature(srdBuf, sizeof(srdBuf)/sizeof(uint32_t)); #else DueFlashStorage::write(SoftwareResetData::nvAddress, srdBuf, sizeof(srdBuf)); @@ -1700,7 +1704,7 @@ void Platform::SoftwareReset(uint16_t reason, const uint32_t *stk) //***************************************************************************************************************** // Interrupts -#if !defined(DUET_NG) && !defined(__RADDS__) +#if HAS_LWIP_NETWORKING void NETWORK_TC_HANDLER() { tc_get_status(NETWORK_TC, NETWORK_TC_CHAN); @@ -1725,7 +1729,7 @@ void Platform::InitialiseInterrupts() // Set the tick interrupt to the highest priority. We need to to monitor the heaters and kick the watchdog. NVIC_SetPriority(SysTick_IRQn, NvicPrioritySystick); // set priority for tick interrupts -#ifdef DUET_NG +#if SAM4E NVIC_SetPriority(UART0_IRQn, NvicPriorityUart); // set priority for UART interrupt - must be higher than step interrupt #else NVIC_SetPriority(UART_IRQn, NvicPriorityUart); // set priority for UART interrupt - must be higher than step interrupt @@ -1743,7 +1747,7 @@ void Platform::InitialiseInterrupts() NVIC_SetPriority(STEP_TC_IRQN, NvicPriorityStep); // set high priority for this IRQ; it's time-critical NVIC_EnableIRQ(STEP_TC_IRQN); -#if !defined(DUET_NG) && !defined(__RADDS__) +#if HAS_LWIP_NETWORKING // Timer interrupt to keep the networking timers running (called at 16Hz) pmc_enable_periph_clk((uint32_t) NETWORK_TC_IRQN); tc_init(NETWORK_TC, NETWORK_TC_CHAN, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK2); @@ -1888,10 +1892,12 @@ void Platform::Diagnostics(MessageType mtype) // Print memory stats and error codes to USB and copy them to the current webserver reply const char *ramstart = -#ifdef DUET_NG +#if SAM4E (char *) 0x20000000; -#else +#elif SAM3XA (char *) 0x20070000; +#else +# error #endif const struct mallinfo mi = mallinfo(); MessageF(mtype, "Static ram used: %d\n", &_end - ramstart); @@ -1905,7 +1911,7 @@ void Platform::Diagnostics(MessageType mtype) // Show the up time and reason for the last reset const uint32_t now = (uint32_t)(millis64()/1000u); // get up time in seconds const char* resetReasons[8] = { "power up", "backup", "watchdog", "software", -#ifdef DUET_NG +#if SAM4E // On the SAM4E a watchdog reset may be reported as a user reset because of the capacitor on the NRST pin "reset button or watchdog", #else @@ -1922,7 +1928,7 @@ void Platform::Diagnostics(MessageType mtype) memset(srdBuf, 0, sizeof(srdBuf)); int slot = -1; -#ifdef DUET_NG +#if SAM4E // Work around bug in ASF flash library: flash_read_user_signature calls a RAMFUNC without disabling interrupts first. // This caused a crash (watchdog timeout) sometimes if we run M122 while a print is in progress const irqflags_t flags = cpu_irq_save(); @@ -1988,16 +1994,16 @@ void Platform::Diagnostics(MessageType mtype) MessageF(mtype, "Free file entries: %u\n", numFreeFiles); // Show the HSMCI CD pin and speed -#if defined( __RADDS__) || defined(__ALLIGATOR__) - MessageF(mtype, "SD card 0 %s\n", (sd_mmc_card_detected(0) ? "detected" : "not detected")); -#else +#if HAS_HIGH_SPEED_SD MessageF(mtype, "SD card 0 %s, interface speed: %.1fMBytes/sec\n", (sd_mmc_card_detected(0) ? "detected" : "not detected"), (double)((float)hsmci_get_speed()/1000000.0)); +#else + MessageF(mtype, "SD card 0 %s\n", (sd_mmc_card_detected(0) ? "detected" : "not detected")); #endif // Show the longest SD card write time MessageF(mtype, "SD card longest block write time: %.1fms\n", (double)FileStore::GetAndClearLongestWriteTime()); -#if !defined( __RADDS__) +#if HAS_CPU_TEMP_SENSOR // Show the MCU temperatures const uint32_t currentMcuTemperature = cpuTemperatureFilter.GetSum(); MessageF(mtype, "MCU temperature: min %.1f, current %.1f, max %.1f\n", @@ -2478,20 +2484,7 @@ void Platform::UpdateMotorCurrent(size_t driver) { TMC2660::SetCurrent(driver, current); } - // else we can't set the current -#elif defined (__RADDS__) - // we can't set the current on RADDS -#elif defined(__ALLIGATOR__) - // Alligator SPI DAC current - if (driver < 4) // Onboard DAC - { - dacAlligator.setChannel(3-driver, current * 0.102); - } - else // Piggy module DAC - { - dacPiggy.setChannel(7-driver, current * 0.102); - } -#else +#elif defined (DUET_06_085) unsigned short pot = (unsigned short)((0.256*current*8.0*senseResistor + maxStepperDigipotVoltage/2)/maxStepperDigipotVoltage); if (driver < 4) { @@ -2500,35 +2493,39 @@ void Platform::UpdateMotorCurrent(size_t driver) } else { -# ifndef DUET_NG if (board == BoardType::Duet_085) { -# endif // Extruder 0 is on DAC channel 0 if (driver == 4) { const float dacVoltage = max<float>(current * 0.008 * senseResistor + stepperDacVoltageOffset, 0.0); // the voltage we want from the DAC relative to its minimum const float dac = dacVoltage/stepperDacVoltageRange; -# ifdef DUET_NG - AnalogOut(DAC1, dac); -# else AnalogOut(DAC0, dac); -# endif } else { mcpExpansion.setNonVolatileWiper(potWipes[driver-1], pot); mcpExpansion.setVolatileWiper(potWipes[driver-1], pot); } -# ifndef DUET_NG } else if (driver < 8) // on a Duet 0.6 we have a maximum of 8 drives { mcpExpansion.setNonVolatileWiper(potWipes[driver], pot); mcpExpansion.setVolatileWiper(potWipes[driver], pot); } -# endif } +#elif defined(__ALLIGATOR__) + // Alligator SPI DAC current + if (driver < 4) // Onboard DAC + { + dacAlligator.setChannel(3-driver, current * 0.102); + } + else // Piggy module DAC + { + dacPiggy.setChannel(7-driver, current * 0.102); + } +#else + // otherwise we can't set the motor current #endif } } @@ -2574,14 +2571,15 @@ bool Platform::SetDriverMicrostepping(size_t driver, int microsteps, int mode) } else { -#elif defined(__ALLIGATOR__) - return Microstepping::Set(driver, microsteps); // no mode in Alligator board -#endif // Other drivers only support x16 microstepping. // We ignore the interpolation on/off parameter so that e.g. M350 I1 E16:128 won't give an error if E1 supports interpolation but E0 doesn't. return microsteps == 16; -#if defined(DUET_NG) } +#elif defined(__ALLIGATOR__) + return Microstepping::Set(driver, microsteps); // no mode in Alligator board +#else + // Assume only x16 microstepping supported + return microsteps == 16; #endif } return false; @@ -2615,13 +2613,16 @@ unsigned int Platform::GetDriverMicrostepping(size_t driver, int mode, bool& int { return TMC2660::GetMicrostepping(driver, mode, interpolation); } + // On-board drivers only support x16 microstepping without interpolation + interpolation = false; + return 16; #elif defined(__ALLIGATOR__) interpolation = false; return Microstepping::Read(driver); // no mode, no interpolation for Alligator -#endif - // On-board drivers only support x16 microstepping without interpolation +#else interpolation = false; return 16; +#endif } // Get the microstepping for an axis or extruder @@ -2721,7 +2722,7 @@ void Platform::SetFanValue(size_t fan, float speed) } } -#if !defined(DUET_NG) && !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if defined(DUET_06_085) // Enable or disable the fan that shares its PWM pin with the last heater. Called when we disable or enable the last heater. void Platform::EnableSharedFan(bool enable) @@ -2747,12 +2748,12 @@ float Platform::GetFanRPM() const bool Platform::FansHardwareInverted(size_t fanNumber) const { -#if defined(DUET_NG) || defined(__RADDS__) || defined(__ALLIGATOR__) - return false; -#else +#if defined(DUET_06_085) // The cooling fan output pin gets inverted on a Duet 0.6 or 0.7. // We allow a second fan controlled by a mosfet on the PC4 pin, which is not inverted. return fanNumber == 0 && (board == BoardType::Duet_06 || board == BoardType::Duet_07); +#else + return false; #endif } @@ -2765,12 +2766,12 @@ void Platform::InitFans() if (NUM_FANS > 1) { -#if defined(DUET_NG) || defined(__RADDS__) || defined(__ALLIGATOR__) - // Set fan 1 to be thermostatic by default, monitoring all heaters except the default bed heater - fans[1].SetHeatersMonitored(((1 << Heaters) - 1) & ~(1 << DefaultBedHeater)); +#if defined(DUET_06_085) + // Fan 1 on the Duet 0.8.5 shares its control pin with heater 6. Set it full on to make sure the heater (if present) is off. fans[1].SetValue(1.0); // set it full on #else - // Fan 1 on the Duet 0.8.5 shares its control pin with heater 6. Set it full on to make sure the heater (if present) is off. + // Set fan 1 to be thermostatic by default, monitoring all heaters except the default bed heater + fans[1].SetHeatersMonitored(((1 << Heaters) - 1) & ~(1 << DefaultBedHeater)); fans[1].SetValue(1.0); // set it full on #endif } @@ -3269,11 +3270,7 @@ void Platform::SetBoardType(BoardType bt) board = BoardType::DuetWiFi_10; #elif defined(DUET_NG) && defined(DUET_ETHERNET) board = BoardType::DuetEthernet_10; -#elif defined(__RADDS__) - board = BoardType::RADDS_15; -#elif defined(__ALLIGATOR__) - board = BoardType::Alligator_2; -#else +#elif defined(DUET_06_085) // Determine whether this is a Duet 0.6 or a Duet 0.8.5 board. // If it is a 0.85 board then DAC0 (AKA digital pin 67) is connected to ground via a diode and a 2.15K resistor. // So we enable the pullup (value 100K-150K) on pin 67 and read it, expecting a LOW on a 0.8.5 board and a HIGH on a 0.6 board. @@ -3281,6 +3278,12 @@ void Platform::SetBoardType(BoardType bt) pinMode(Dac0DigitalPin, INPUT_PULLUP); board = (digitalRead(Dac0DigitalPin)) ? BoardType::Duet_06 : BoardType::Duet_085; pinMode(Dac0DigitalPin, INPUT); // turn pullup off +#elif defined(__RADDS__) + board = BoardType::RADDS_15; +#elif defined(__ALLIGATOR__) + board = BoardType::Alligator_2; +#else +# error Undefined board type #endif } else @@ -3304,14 +3307,16 @@ const char* Platform::GetElectronicsString() const case BoardType::DuetWiFi_10: return "Duet WiFi 1.0"; #elif defined(DUET_NG) && defined(DUET_ETHERNET) case BoardType::DuetEthernet_10: return "Duet Ethernet 1.0"; +#elif defined(DUET_06_085) + case BoardType::Duet_06: return "Duet 0.6"; + case BoardType::Duet_07: return "Duet 0.7"; + case BoardType::Duet_085: return "Duet 0.85"; #elif defined(__RADDS__) case BoardType::RADDS_15: return "RADDS 1.5"; #elif defined(__ALLIGATOR__) case BoardType::Alligator_2: return "Alligator r2"; #else - case BoardType::Duet_06: return "Duet 0.6"; - case BoardType::Duet_07: return "Duet 0.7"; - case BoardType::Duet_085: return "Duet 0.85"; +# error Undefined board type #endif default: return "Unidentified"; } @@ -3326,14 +3331,16 @@ const char* Platform::GetBoardString() const case BoardType::DuetWiFi_10: return "duetwifi10"; #elif defined(DUET_NG) && defined(DUET_ETHERNET) case BoardType::DuetEthernet_10: return "duetethernet10"; +#elif defined(DUET_06_085) + case BoardType::Duet_06: return "duet06"; + case BoardType::Duet_07: return "duet07"; + case BoardType::Duet_085: return "duet085"; #elif defined(__RADDS__) case BoardType::RADDS_15: return "radds15"; #elif defined(__ALLIGATOR__) case BoardType::Alligator_2: return "alligator2"; #else - case BoardType::Duet_06: return "duet06"; - case BoardType::Duet_07: return "duet07"; - case BoardType::Duet_085: return "duet085"; +# error Undefined board type #endif default: return "unknown"; } @@ -3368,7 +3375,7 @@ bool Platform::GetFirmwarePin(int logicalPin, PinAccess access, Pin& firmwarePin ) { firmwarePin = COOLING_FAN_PINS[logicalPin - Fan0LogicalPin]; -#if !defined(DUET_NG) && !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if defined(DUET_06_085) invert = (board == BoardType::Duet_06 || board == BoardType::Duet_07); #endif } @@ -3490,7 +3497,7 @@ bool Platform::Inkjet(int bitPattern) } #endif -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR // CPU temperature void Platform::GetMcuTemperatures(float& minT, float& currT, float& maxT) const { @@ -3762,10 +3769,9 @@ void Platform::Tick() } // Read the MCU temperature as well (no need to do it in every state) -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR const_cast<ThermistorAveragingFilter&>(cpuTemperatureFilter).ProcessReading(AnalogInReadChannel(temperatureAdcChannel)); #endif - ++tickState; break; diff --git a/src/Platform.h b/src/Platform.h index 6a027d95..adcce6ce 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -52,12 +52,12 @@ Licence: GPL #if defined(DUET_NG) # include "DueXn.h" +#elif defined(DUET_06_085) +# include "MCP4461/MCP4461.h" #elif defined(__ALLIGATOR__) # include "DAC/DAC084S085.h" // SPI DAC for motor current vref # include "EUI48/EUI48EEPROM.h" // SPI EUI48 mac address EEPROM # include "Microstepping.h" -#elif !defined(__RADDS__) -# include "MCP4461/MCP4461.h" #endif const bool FORWARDS = true; @@ -96,12 +96,12 @@ const float AXIS_MAXIMA[MaxAxes] = AXES_(230.0, 210.0, 200.0, 0.0, 0.0, 0.0, 0.0 const float Z_PROBE_STOP_HEIGHT = 0.7; // Millimetres const unsigned int Z_PROBE_AVERAGE_READINGS = 8; // We average this number of readings with IR on, and the same number with IR off -#ifdef DUET_NG -const int Z_PROBE_AD_VALUE = 500; // Default for the Z probe - should be overwritten by experiment -const uint32_t Z_PROBE_AXES = (1 << Z_AXIS); // Axes for which the Z-probe is normally used -#else +#if defined DUET_06_085 const int Z_PROBE_AD_VALUE = 400; // Default for the Z probe - should be overwritten by experiment const uint32_t Z_PROBE_AXES = (1 << X_AXIS) | (1 << Z_AXIS); // Axes for which the Z-probe is normally used +#else +const int Z_PROBE_AD_VALUE = 500; // Default for the Z probe - should be overwritten by experiment +const uint32_t Z_PROBE_AXES = (1 << Z_AXIS); // Axes for which the Z-probe is normally used #endif // HEATERS - The bed is assumed to be the at index 0 @@ -128,14 +128,16 @@ enum class BoardType : uint8_t DuetWiFi_10 = 1 #elif defined(DUET_NG) && defined(DUET_ETHERNET) DuetEthernet_10 = 1 +#elif defined(DUET_06_085) + Duet_06 = 1, + Duet_07 = 2, + Duet_085 = 3 #elif defined(__RADDS__) RADDS_15 = 1 #elif defined(__ALLIGATOR__) Alligator_2 = 1 #else - Duet_06 = 1, - Duet_07 = 2, - Duet_085 = 3 +# error Unknown board #endif }; @@ -527,10 +529,11 @@ public: float GetFanValue(size_t fan) const; // Result is returned in percent void SetFanValue(size_t fan, float speed); // Accepts values between 0..1 and 1..255 -#if !defined(DUET_NG) && !defined(__RADDS__) & !defined(__ALLIGATOR__) +#if defined(DUET_06_085) void EnableSharedFan(bool enable); // enable/disable the fan that shares its PWM pin with the last heater #endif + bool WriteFanSettings(FileStore *f) const; // Save some resume information float GetFanRPM() const; // Flash operations @@ -553,7 +556,7 @@ public: bool Inkjet(int bitPattern); // MCU temperature -#ifndef __RADDS +#if HAS_CPU_TEMP_SENSOR void GetMcuTemperatures(float& minT, float& currT, float& maxT) const; #endif void SetMcuTemperatureAdjust(float v) { mcuTemperatureAdjust = v; } @@ -571,7 +574,6 @@ public: float GetTmcDriversTemperature(unsigned int board) const; void DriverCoolingFansOn(uint32_t driverChannelsMonitored); bool ConfigureAutoSave(GCodeBuffer& gb, StringRef& reply); - bool WriteFanSettings(FileStore *f) const; // Save some resume information #endif // User I/O and servo support @@ -611,7 +613,7 @@ private: { static const uint16_t versionValue = 7; // increment this whenever this struct changes static const uint16_t magicValue = 0x7D00 | versionValue; // value we use to recognise that all the flash data has been written -#ifndef DUET_NG +#if SAM3XA static const uint32_t nvAddress = 0; // must be 4-byte aligned #endif static const size_t numberOfSlots = 5; // number of storage slots used to implement wear levelling - must fit in 512 bytes @@ -641,7 +643,7 @@ private: } }; -#ifdef DUET_NG +#if SAM4E static_assert(SoftwareResetData::numberOfSlots * sizeof(SoftwareResetData) <= 512, "Can't fit software reset data in SAM4E user signature area"); #else static_assert(SoftwareResetData::numberOfSlots * sizeof(SoftwareResetData) <= FLASH_DATA_LENGTH, "NVData too large"); @@ -708,11 +710,7 @@ private: #if defined(DUET_NG) size_t numTMC2660Drivers; // the number of TMC2660 drivers we have, the remaining are simple enable/step/dir drivers -#elif defined(__ALLIGATOR__) - Pin spiDacCS[MaxSpiDac]; - DAC084S085 dacAlligator; - DAC084S085 dacPiggy; -#elif !defined(__RADDS__) +#elif defined(DUET_06_085) // Digipots MCP4461 mcpDuet; MCP4461 mcpExpansion; @@ -720,6 +718,10 @@ private: float senseResistor; float maxStepperDigipotVoltage; float stepperDacVoltageRange, stepperDacVoltageOffset; +#elif defined(__ALLIGATOR__) + Pin spiDacCS[MaxSpiDac]; + DAC084S085 dacAlligator; + DAC084S085 dacPiggy; #endif // Z probe @@ -732,7 +734,7 @@ private: // Thermistors volatile ThermistorAveragingFilter thermistorFilters[Heaters]; // bed and extruder thermistor readings -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR volatile ThermistorAveragingFilter cpuTemperatureFilter; // MCU temperature readings #endif @@ -832,7 +834,7 @@ private: float nozzleDiameter; // Temperature and power monitoring -#ifndef __RADDS__ // reading temperature on the RADDS messes up one of the heater pins, so don't do it +#if HAS_CPU_TEMP_SENSOR // reading temperature on the RADDS messes up one of the heater pins, so don't do it AnalogChannelNumber temperatureAdcChannel; uint32_t highestMcuTemperature, lowestMcuTemperature; #endif @@ -1263,12 +1265,14 @@ inline OutputBuffer *Platform::GetAuxGCodeReply() const PinDescription& pinDesc = g_APinDescription[STEP_PINS[driver]]; #if defined(DUET_NG) return pinDesc.ulPin; +#elif defined(DUET_06_085) + return (pinDesc.pPort == PIOA) ? pinDesc.ulPin << 1 : pinDesc.ulPin; #elif defined(__RADDS__) return (pinDesc.pPort == PIOC) ? pinDesc.ulPin << 1 : pinDesc.ulPin; #elif defined(__ALLIGATOR__) return pinDesc.ulPin; -#else // Duet 06/085 - return (pinDesc.pPort == PIOA) ? pinDesc.ulPin << 1 : pinDesc.ulPin; +#else +# error Unknown board #endif } @@ -1279,6 +1283,10 @@ inline OutputBuffer *Platform::GetAuxGCodeReply() { #if defined(DUET_NG) PIOD->PIO_ODSR = driverMap; // on Duet WiFi all step pins are on port D +#elif defined(DUET_06_085) + PIOD->PIO_ODSR = driverMap; + PIOC->PIO_ODSR = driverMap; + PIOA->PIO_ODSR = driverMap >> 1; // do this last, it means the processor doesn't need to preserve the register containing driverMap #elif defined(__RADDS__) PIOA->PIO_ODSR = driverMap; PIOB->PIO_ODSR = driverMap; @@ -1288,10 +1296,8 @@ inline OutputBuffer *Platform::GetAuxGCodeReply() PIOB->PIO_ODSR = driverMap; PIOD->PIO_ODSR = driverMap; PIOC->PIO_ODSR = driverMap; -#else // Duet 06/085 - PIOD->PIO_ODSR = driverMap; - PIOC->PIO_ODSR = driverMap; - PIOA->PIO_ODSR = driverMap >> 1; // do this last, it means the processor doesn't need to preserve the register containing driverMap +#else +# error Unknown board #endif } @@ -1302,6 +1308,10 @@ inline OutputBuffer *Platform::GetAuxGCodeReply() { #if defined(DUET_NG) PIOD->PIO_ODSR = 0; // on Duet WiFi all step pins are on port D +#elif defined(DUET_06_085) + PIOD->PIO_ODSR = 0; + PIOC->PIO_ODSR = 0; + PIOA->PIO_ODSR = 0; #elif defined(__RADDS__) PIOD->PIO_ODSR = 0; PIOC->PIO_ODSR = 0; @@ -1311,10 +1321,8 @@ inline OutputBuffer *Platform::GetAuxGCodeReply() PIOD->PIO_ODSR = 0; PIOC->PIO_ODSR = 0; PIOB->PIO_ODSR = 0; -#else // Duet - PIOD->PIO_ODSR = 0; - PIOC->PIO_ODSR = 0; - PIOA->PIO_ODSR = 0; +#else +# error Unknown board #endif } diff --git a/src/RADDS/Pins_RADDS.h b/src/RADDS/Pins_RADDS.h index c218c592..6f4b26cb 100644 --- a/src/RADDS/Pins_RADDS.h +++ b/src/RADDS/Pins_RADDS.h @@ -3,6 +3,11 @@ #define FIRMWARE_NAME "RepRapFirmware for RADDS" +// Features definition +#define HAS_LWIP_NETWORKING 0 +#define HAS_CPU_TEMP_SENSOR 0 // enabling the CPU temperature sensor disables Due pin 13 due to bug in SAM3X +#define HAS_HIGH_SPEED_SD 0 + const size_t NumFirmwareUpdateModules = 1; #define IAP_UPDATE_FILE "iapradds.bin" #define IAP_FIRMWARE_FILE "RepRapFirmware-RADDS.bin" diff --git a/src/RepRap.cpp b/src/RepRap.cpp index 6f73fd6d..26ecb0bf 100644 --- a/src/RepRap.cpp +++ b/src/RepRap.cpp @@ -19,7 +19,7 @@ # include "PortControl.h" #endif -#if !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if HAS_HIGH_SPEED_SD # include "sam/drivers/hsmci/hsmci.h" #endif @@ -137,7 +137,7 @@ void RepRap::Init() // Enable network (unless it's disabled) network->Activate(); // Need to do this here, as the configuration GCodes may set IP address etc. -#if !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if HAS_HIGH_SPEED_SD hsmci_set_idle_func(hsmciIdle); #endif platform->MessageF(UsbMessage, "%s is up and running.\n", FIRMWARE_NAME); @@ -148,7 +148,7 @@ void RepRap::Init() void RepRap::Exit() { -#if !defined(__RADDS__) && !defined(__ALLIGATOR__) +#if HAS_HIGH_SPEED_SD hsmci_set_idle_func(nullptr); #endif active = false; @@ -1038,7 +1038,7 @@ OutputBuffer *RepRap::GetStatusResponse(uint8_t type, ResponseSource source) } // MCU temperatures -#ifndef __RADDS__ +#if HAS_CPU_TEMP_SENSOR { float minT, currT, maxT; platform->GetMcuTemperatures(minT, currT, maxT); @@ -1764,8 +1764,6 @@ AxesBitmap RepRap::GetCurrentYAxes() const return (currentTool == nullptr) ? DefaultYAxisMapping : currentTool->GetYAxisMap(); } -#ifdef DUET_NG - // Save some resume information, returning true if successful // We assume that the tool configuration doesn't change, only the temperatures and the mix bool RepRap::WriteToolSettings(FileStore *f) const @@ -1788,8 +1786,6 @@ bool RepRap::WriteToolSettings(FileStore *f) const return ok; } -#endif - // Helper function for diagnostic tests in Platform.cpp, to cause a deliberate divide-by-zero /*static*/ uint32_t RepRap::DoDivide(uint32_t a, uint32_t b) { diff --git a/src/RepRap.h b/src/RepRap.h index 5293ebaa..2c3ceeeb 100644 --- a/src/RepRap.h +++ b/src/RepRap.h @@ -104,9 +104,7 @@ public: void SetAlert(const char *msg, const char *title, int mode, float timeout, AxesBitmap controls); void ClearAlert(); -#ifdef DUET_NG bool WriteToolSettings(FileStore *f) const; // Save some resume information -#endif static uint32_t DoDivide(uint32_t a, uint32_t b); // helper function for diagnostic tests static uint32_t ReadDword(const char* p); // helper function for diagnostic tests diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h index a4b18149..5f3f9c9c 100644 --- a/src/RepRapFirmware.h +++ b/src/RepRapFirmware.h @@ -215,7 +215,7 @@ const uint32_t NvicPriorityPins = 3; // priority for GPIO pin interrupts - fil const uint32_t NvicPriorityStep = 4; // step interrupt is next highest, it can preempt most other interrupts const uint32_t NvicPriorityUSB = 5; // USB interrupt -#if !defined(DUET_NG) && !defined(__RADDS__) +#if HAS_LWIP_NETWORKING const uint32_t NvicPriorityNetworkTick = 5; // priority for network tick interrupt const uint32_t NvicPriorityEthernet = 5; // priority for Ethernet interface #endif diff --git a/src/Tools/Tool.cpp b/src/Tools/Tool.cpp index 57419f3b..230c5356 100644 --- a/src/Tools/Tool.cpp +++ b/src/Tools/Tool.cpp @@ -423,8 +423,6 @@ void Tool::DefineMix(const float m[]) } } -#ifdef DUET_NG - // Write the tool's settings to file returning true if successful bool Tool::WriteSettings(FileStore *f) const { @@ -463,6 +461,4 @@ bool Tool::WriteSettings(FileStore *f) const return ok; } -#endif - // End diff --git a/src/Tools/Tool.h b/src/Tools/Tool.h index 39e677e9..6144e5b4 100644 --- a/src/Tools/Tool.h +++ b/src/Tools/Tool.h @@ -69,10 +69,7 @@ public: Filament *GetFilament() const { return filament; } Tool *Next() const { return next; } ToolState GetState() const { return state; } - -#ifdef DUET_NG bool WriteSettings(FileStore *f) const; // write the tool's settings to file -#endif friend class RepRap; diff --git a/src/Version.h b/src/Version.h index 7cb61c08..d0ee8670 100644 --- a/src/Version.h +++ b/src/Version.h @@ -9,11 +9,11 @@ #define SRC_VERSION_H_ #ifndef VERSION -# define VERSION "1.20alpha3" +# define VERSION "1.20alpha4" #endif #ifndef DATE -# define DATE "2017-09-22" +# define DATE "2017-09-24" #endif #define AUTHORS "reprappro, dc42, chrishamm, t3p3, dnewman" |