Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2016-08-23 23:28:28 +0300
committerDavid Crocker <dcrocker@eschertech.com>2016-08-23 23:28:28 +0300
commit658cfc8923a15d5dc3ae01ae53ac3d34e4ce28c2 (patch)
tree0002ffc6e7edfb36775e0c2fc6851663b26508e5 /src
parentc64bf3f7838c842efa3154f45481e50b51bc1077 (diff)
Version 1.15 release
Relocated heater 7 to correrct pin on Duet WiFi Fixed thermistor reading startup issues Added over/under voltage count on Duet WiFi
Diffstat (limited to 'src')
-rw-r--r--src/Configuration.h4
-rw-r--r--src/DuetNG/Pins_DuetNG.h2
-rw-r--r--src/DuetNG/TMC2660.cpp8
-rw-r--r--src/Heating/Pid.cpp2
-rw-r--r--src/Platform.cpp34
-rw-r--r--src/Platform.h3
6 files changed, 35 insertions, 18 deletions
diff --git a/src/Configuration.h b/src/Configuration.h
index 0aeefc84..c42aab13 100644
--- a/src/Configuration.h
+++ b/src/Configuration.h
@@ -26,11 +26,11 @@ Licence: GPL
// Firmware name is now defined in the Pins file
#ifndef VERSION
-# define VERSION "1.15-rc4"
+# define VERSION "1.15"
#endif
#ifndef DATE
-# define DATE "2016-08-21"
+# define DATE "2016-08-23"
#endif
#define AUTHORS "reprappro, dc42, zpl, t3p3, dnewman"
diff --git a/src/DuetNG/Pins_DuetNG.h b/src/DuetNG/Pins_DuetNG.h
index 7e9417e5..aa2e637e 100644
--- a/src/DuetNG/Pins_DuetNG.h
+++ b/src/DuetNG/Pins_DuetNG.h
@@ -68,7 +68,7 @@ const Pin TEMP_SENSE_PINS[HEATERS] = { 45, 47, 44, 61, 62, 63, 59, 18 }; // Ther
#ifdef PROTOTYPE_1
const Pin HEAT_ON_PINS[HEATERS] = { 19, 20, 16, 15, 37, 40, 43, 38 }; // Heater pin numbers
#else
-const Pin HEAT_ON_PINS[HEATERS] = { 19, 20, 16, 35, 37, 40, 43, 38 }; // Heater pin numbers (heater 7 pin TBC)
+const Pin HEAT_ON_PINS[HEATERS] = { 19, 20, 16, 35, 37, 40, 43, 15 }; // Heater pin numbers (heater 7 pin TBC)
#endif
// Default thermistor parameters
diff --git a/src/DuetNG/TMC2660.cpp b/src/DuetNG/TMC2660.cpp
index 7962e870..deded08b 100644
--- a/src/DuetNG/TMC2660.cpp
+++ b/src/DuetNG/TMC2660.cpp
@@ -467,10 +467,12 @@ namespace TMC2660
}
// Flag the the drivers have been powered up.
- // Must call Init() before the first call to say the drivers have been powered uo.
+ // Important notes:
+ // 1. Before the first call to this function with powered true, you must call Init().
+ // 2. This may be called by the tick ISR with powered false, possibly while another call (with powered either true or false) is being executed
void SetDriversPowered(bool powered)
{
- bool wasPowered = driversPowered;
+ const bool wasPowered = driversPowered;
driversPowered = powered;
if (powered && !wasPowered)
{
@@ -483,7 +485,7 @@ namespace TMC2660
driverStates[drive].WriteAll();
}
}
- else if (!powered and wasPowered)
+ else if (!powered && wasPowered)
{
digitalWrite(GlobalTmcEnablePin, HIGH); // disable the drivers
}
diff --git a/src/Heating/Pid.cpp b/src/Heating/Pid.cpp
index e1481dc7..04296697 100644
--- a/src/Heating/Pid.cpp
+++ b/src/Heating/Pid.cpp
@@ -233,7 +233,7 @@ void PID::Spin()
break;
case HeaterMode::stable:
- if (fabs(error) > MaxStableTemperatureError)
+ if (fabs(error) > MaxStableTemperatureError && temperature > MaxAmbientTemperature)
{
++heatingFaultCount;
if (heatingFaultCount * platform->HeatSampleInterval() > MaxHeatingFaultTime * SecondsToMillis)
diff --git a/src/Platform.cpp b/src/Platform.cpp
index 6030e644..794ab945 100644
--- a/src/Platform.cpp
+++ b/src/Platform.cpp
@@ -69,9 +69,9 @@ uint32_t lastInterruptTime = 0;
void UrgentInit()
{
#ifdef DUET_NG
- // When the reset button is pressed, if the TMC2660 drivers were previously enabled then we get uncommanded motor movements.
- // Try to reduce that by initialising the drivers early here.
- // On the production board we will also be able to set the ENN line high here.
+ // When the reset button is pressed on pre-production Duet WiFi boards, if the TMC2660 drivers were previously enabled then we get
+ // uncommanded motor movements if the STEP lines pick up any noise. Try to reduce that by initialising the drivers early here.
+ // On the production boards the ENN line is pulled high and that prevents motor movements.
for (size_t drive = 0; drive < DRIVES; ++drive)
{
pinMode(STEP_PINS[drive], OUTPUT_LOW);
@@ -322,7 +322,7 @@ void Platform::Init()
}
const PinDescription& pinDesc = g_APinDescription[STEP_PINS[drive]];
- pinDesc.pPort->PIO_OWER = pinDesc.ulPin; // enable parallel writes to the step pin
+ pinDesc.pPort->PIO_OWER = pinDesc.ulPin; // enable parallel writes to the step pins
motorCurrents[drive] = 0.0;
motorCurrentFraction[drive] = 1.0;
@@ -403,6 +403,7 @@ void Platform::Init()
AnalogInEnableChannel(vInMonitorAdcChannel, true);
currentVin = highestVin = 0;
lowestVin = 9999;
+ numUnderVoltageEvents = numOverVoltageEvents = 0;
#endif
// Clear the spare pin configuration
@@ -412,6 +413,12 @@ void Platform::Init()
lastTime = Time();
longWait = lastTime;
InitialiseInterrupts(); // also sets 'active' to true
+
+ // Allow the thermistors to collect enough readings to average before we response to PanelDue requests or allow heater to be turned on,
+ // otherwise we may send bad data to PanelDue, which confuses older firmware versions, and/or get PID problems.
+ // We read 1 heater every 2 system ticks, hence the wait for THERMISTOR_AVERAGE_READINGS * HEATERS * 2 ticks.
+ // We allow an extra 2 reads per thermistor, because the first few ADC readings may be inaccurate.
+ delay((THERMISTOR_AVERAGE_READINGS + 2) * HEATERS * 2);
}
void Platform::InvalidateFiles(const FATFS *fs)
@@ -1207,13 +1214,20 @@ void Platform::Spin()
}
#ifdef DUET_NG
- // Check whether the TMC drivers need to be initialised
+ // Check whether the TMC drivers need to be initialised.
+ // The tick ISR also looks for over-voltage events, but it just disables the driver without changing driversPowerd or numOverVoltageEvents
if (driversPowered)
{
- if (currentVin < driverPowerOffAdcReading || currentVin > driverOverVoltageAdcReading)
+ if (currentVin < driverPowerOffAdcReading)
{
+ ++numUnderVoltageEvents;
driversPowered = false;
}
+ else if (currentVin > driverOverVoltageAdcReading)
+ {
+ driversPowered = false;
+ ++numOverVoltageEvents;
+ }
}
else if (currentVin >= driverPowerOnAdcReading && currentVin <= driverNormalVoltageAdcReading)
{
@@ -1437,8 +1451,9 @@ void Platform::Diagnostics(MessageType mtype)
#ifdef DUET_NG
// Show the supply voltage
- MessageF(mtype, "Supply voltage: min %.1f, current %.1f, max %.1f\n",
- AdcReadingToPowerVoltage(lowestVin), AdcReadingToPowerVoltage(currentVin), AdcReadingToPowerVoltage(highestVin));
+ MessageF(mtype, "Supply voltage: min %.1f, current %.1f, max %.1f, under voltage events: %u, over voltage events: %u\n",
+ AdcReadingToPowerVoltage(lowestVin), AdcReadingToPowerVoltage(currentVin), AdcReadingToPowerVoltage(highestVin),
+ numUnderVoltageEvents, numOverVoltageEvents);
lowestVin = highestVin = currentVin;
#endif
@@ -2811,9 +2826,8 @@ void Platform::Tick()
}
if (driversPowered && currentVin > driverOverVoltageAdcReading)
{
- driversPowered = false;
TMC2660::SetDriversPowered(false);
- //TODO set ENN high on production boards
+ // We deliberately do not clear driversPowered here or increase the over voltage event count - we let the spin loop handle that
}
#endif
}
diff --git a/src/Platform.h b/src/Platform.h
index 8d8dce66..621101cf 100644
--- a/src/Platform.h
+++ b/src/Platform.h
@@ -879,7 +879,8 @@ private:
#ifdef DUET_NG
AnalogChannelNumber vInMonitorAdcChannel;
volatile uint16_t currentVin, highestVin, lowestVin;
- uint16_t upperVinLimit, lowerVinLimit;
+ uint32_t numUnderVoltageEvents;
+ volatile uint32_t numOverVoltageEvents;
bool driversPowered;
#endif