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
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2021-11-06 16:31:18 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-11-06 16:31:18 +0300
commiteebd32c8f7e40aaaef055e86eccbe166c741a70c (patch)
treeb678c2e7ed1d52d2f4265175db4d00ea8e158537
parent0feb1388fdc29c09e1183203a142f7f01a6a6c14 (diff)
Removed default PS_ON (still version 3.4.0beta6)3.4.0beta6
-rw-r--r--src/Duet3Mini/Pins_Duet3Mini.h1
-rw-r--r--src/Duet3_V06/Pins_Duet3_V06.h1
-rw-r--r--src/DuetM/Pins_DuetM.h1
-rw-r--r--src/DuetNG/Pins_DuetNG.h1
-rw-r--r--src/Pins.h4
-rw-r--r--src/Platform/Platform.cpp34
-rw-r--r--src/Platform/Platform.h3
7 files changed, 20 insertions, 25 deletions
diff --git a/src/Duet3Mini/Pins_Duet3Mini.h b/src/Duet3Mini/Pins_Duet3Mini.h
index 03b26543..3c5d3a2b 100644
--- a/src/Duet3Mini/Pins_Duet3Mini.h
+++ b/src/Duet3Mini/Pins_Duet3Mini.h
@@ -47,7 +47,6 @@ constexpr uint32_t IAP_IMAGE_START = 0x20038000;
#define HAS_VOLTAGE_MONITOR 1
#define ENFORCE_MAX_VIN 0
#define HAS_VREF_MONITOR 1
-#define HAS_DEFAULT_PSON_PIN 1
#define SUPPORT_CAN_EXPANSION 1
diff --git a/src/Duet3_V06/Pins_Duet3_V06.h b/src/Duet3_V06/Pins_Duet3_V06.h
index f674df88..37e8c2a3 100644
--- a/src/Duet3_V06/Pins_Duet3_V06.h
+++ b/src/Duet3_V06/Pins_Duet3_V06.h
@@ -32,7 +32,6 @@ constexpr uint32_t IAP_IMAGE_START = 0x20458000; // last 32kb of RAM
#define HAS_12V_MONITOR 1
#define ENFORCE_MIN_V12 1
#define HAS_VREF_MONITOR 1
-#define HAS_DEFAULT_PSON_PIN 1
#define SUPPORT_CAN_EXPANSION 1
#define DUAL_CAN 1 // support the second CAN interface as simple CAN (not FD)
diff --git a/src/DuetM/Pins_DuetM.h b/src/DuetM/Pins_DuetM.h
index 6c98159a..5a35ab0a 100644
--- a/src/DuetM/Pins_DuetM.h
+++ b/src/DuetM/Pins_DuetM.h
@@ -32,7 +32,6 @@ constexpr uint32_t IAP_IMAGE_START = 0x20018000;
#define HAS_VOLTAGE_MONITOR 1
#define ENFORCE_MAX_VIN 0
#define HAS_VREF_MONITOR 1
-#define HAS_DEFAULT_PSON_PIN 1
#define SUPPORT_INKJET 0 // set nonzero to support inkjet control
#define SUPPORT_ROLAND 0 // set nonzero to support Roland mill
diff --git a/src/DuetNG/Pins_DuetNG.h b/src/DuetNG/Pins_DuetNG.h
index 62b5e25f..e01a5b9e 100644
--- a/src/DuetNG/Pins_DuetNG.h
+++ b/src/DuetNG/Pins_DuetNG.h
@@ -61,7 +61,6 @@ constexpr uint32_t IAP_IMAGE_START = 0x20018000; // IAP is loaded into the last
#define HAS_VOLTAGE_MONITOR 1
#define ENFORCE_MAX_VIN 1
#define HAS_VREF_MONITOR 0
-#define HAS_DEFAULT_PSON_PIN 1
#define ACTIVE_LOW_HEAT_ON 1
#define SUPPORT_INKJET 0 // set nonzero to support inkjet control
diff --git a/src/Pins.h b/src/Pins.h
index efa33b99..d52cf223 100644
--- a/src/Pins.h
+++ b/src/Pins.h
@@ -126,10 +126,6 @@
# define ENFORCE_MIN_V12 0
#endif
-#ifndef HAS_DEFAULT_PSON_PIN
-# define HAS_DEFAULT_PSON_PIN 0
-#endif
-
#if !HAS_VOLTAGE_MONITOR
# define ENFORCE_MAX_VIN 0
#endif
diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp
index 9d935855..293f4038 100644
--- a/src/Platform/Platform.cpp
+++ b/src/Platform/Platform.cpp
@@ -425,7 +425,6 @@ Platform::Platform() noexcept :
#if SUPPORT_LASER
lastLaserPwm(0.0),
#endif
- atxPowerControlled(false),
deferredPowerDown(false)
{
}
@@ -509,12 +508,6 @@ void Platform::Init() noexcept
BoardConfig::Init();
#endif
-#if HAS_DEFAULT_PSON_PIN
- // Set up the default PS_ON port. Initialise it to off in case it is being used for something else or is inverted.
- String<1> dummy;
- PsOnPort.AssignPort("pson", dummy.GetRef(), PinUsedBy::gpout, PinAccess::write0);
-#endif
-
// Ethernet networking defaults
ipAddress = DefaultIpAddress;
netMask = DefaultNetMask;
@@ -3654,12 +3647,10 @@ GCodeResult Platform::HandleM80(GCodeBuffer& gb, const StringRef& reply) THROWS(
if (gb.Seen('C'))
{
rslt = GetGCodeResultFromSuccess(PsOnPort.AssignPort(gb, reply, PinUsedBy::gpout, PinAccess::write1));
- atxPowerControlled = PsOnPort.IsValid();
}
else if (PsOnPort.IsValid())
{
PsOnPort.WriteDigital(true);
- atxPowerControlled = true;
rslt = GCodeResult::ok;
}
else
@@ -3674,14 +3665,27 @@ GCodeResult Platform::HandleM80(GCodeBuffer& gb, const StringRef& reply) THROWS(
GCodeResult Platform::HandleM81(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException)
{
- deferredPowerDown = gb.Seen('S') && gb.GetUIValue() != 0;
- atxPowerControlled = true; // set this before calling AtxPowerOff
- if (!deferredPowerDown)
+ GCodeResult rslt;
+ if (gb.Seen('C'))
{
- AtxPowerOff();
+ rslt = GetGCodeResultFromSuccess(PsOnPort.AssignPort(gb, reply, PinUsedBy::gpout, PinAccess::write0));
+ }
+ else if (PsOnPort.IsValid())
+ {
+ deferredPowerDown = gb.Seen('S') && gb.GetUIValue() != 0;
+ if (!deferredPowerDown)
+ {
+ AtxPowerOff();
+ }
+ rslt = GCodeResult::ok;
+ }
+ else
+ {
+ reply.copy("No PS_ON port defined");
+ rslt = GCodeResult::error;
}
reprap.StateUpdated();
- return GCodeResult::ok;
+ return rslt;
}
void Platform::AtxPowerOff() noexcept
@@ -3696,7 +3700,7 @@ void Platform::AtxPowerOff() noexcept
#endif
// The PS_ON pin on Duet 3 is shared with another pin, so only try to turn off ATX power if we know that power is being controlled
- if (atxPowerControlled)
+ if (IsAtxPowerControlled())
{
PsOnPort.WriteDigital(false);
reprap.StateUpdated();
diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h
index a3f8b7c3..c6c7ae77 100644
--- a/src/Platform/Platform.h
+++ b/src/Platform/Platform.h
@@ -331,7 +331,7 @@ public:
GCodeResult HandleM80(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException);
GCodeResult HandleM81(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException);
void AtxPowerOff() noexcept;
- bool IsAtxPowerControlled() const noexcept { return atxPowerControlled; }
+ bool IsAtxPowerControlled() const noexcept { return PsOnPort.IsValid(); }
const IoPort& GetAtxPowerPort() const noexcept { return PsOnPort; }
BoardType GetBoardType() const noexcept { return board; }
@@ -885,7 +885,6 @@ private:
// Power on/off
IoPort PsOnPort;
- bool atxPowerControlled;
bool deferredPowerDown;
// Misc