diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-08-31 14:31:00 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-08-31 14:31:00 +0300 |
commit | 9365fa7b739854f06b76c16d5d8dc61c7481950c (patch) | |
tree | cdc11c9e67e57ae0780e3a7b40a7563c14f0b840 /src | |
parent | 07d6b8078ae0c3ac9fe43a3da2717ed7c20fe69d (diff) | |
parent | d3550b3b618b16f25b70c4a2e9b74cfba4b9c7fe (diff) |
Merge branch '3.4-dev' into 3.4-extruder-only-movement-fix3.4-extruder-only-movement-fix
Diffstat (limited to 'src')
-rw-r--r-- | src/Config/Pins_Duet3_MB6XD.h | 2 | ||||
-rw-r--r-- | src/GCodes/GCodeBuffer/StringParser.cpp | 2 | ||||
-rw-r--r-- | src/GCodes/GCodes2.cpp | 4 | ||||
-rw-r--r-- | src/Networking/ESP8266WiFi/WiFiInterface.cpp | 27 | ||||
-rw-r--r-- | src/Networking/ESP8266WiFi/WiFiInterface.h | 2 | ||||
-rw-r--r-- | src/Platform/Platform.cpp | 6 | ||||
-rw-r--r-- | src/Version.h | 2 |
7 files changed, 34 insertions, 11 deletions
diff --git a/src/Config/Pins_Duet3_MB6XD.h b/src/Config/Pins_Duet3_MB6XD.h index 6d597b01..c8a296e4 100644 --- a/src/Config/Pins_Duet3_MB6XD.h +++ b/src/Config/Pins_Duet3_MB6XD.h @@ -113,6 +113,8 @@ constexpr GpioPinFunction StepGatePinFunction = GpioPinFunction::C; // TIOB11 #define STEP_GATE_TC_ID (ID_TC11) // ID for peripheral clock and interrupt #define STEP_GATE_TC_CHAN (2) +constexpr uint32_t DefaultStandstillCurrentPercent = 71; // needed to support expansion boards + // Thermistor/PT1000 inputs constexpr Pin TEMP_SENSE_PINS[NumThermistorInputs] = { PortCPin(15), PortCPin(29), PortCPin(0), PortCPin(31) }; // Thermistor/PT1000 pins constexpr Pin VssaSensePin = PortCPin(13); diff --git a/src/GCodes/GCodeBuffer/StringParser.cpp b/src/GCodes/GCodeBuffer/StringParser.cpp index bd8b2c74..75113d42 100644 --- a/src/GCodes/GCodeBuffer/StringParser.cpp +++ b/src/GCodes/GCodeBuffer/StringParser.cpp @@ -433,7 +433,7 @@ void StringParser::CheckForMixedSpacesAndTabs() noexcept if (seenMetaCommand && !warnedAboutMixedSpacesAndTabs && seenLeadingSpace && seenLeadingTab) { reprap.GetPlatform().MessageF(AddWarning(gb.GetResponseMessageType()), - "both space and tab characters used to indent blocks by line %" PRIu32, gb.GetLineNumber()); + "both space and tab characters used to indent blocks at/before line %" PRIu32 "\n", gb.GetLineNumber()); warnedAboutMixedSpacesAndTabs = true; } } diff --git a/src/GCodes/GCodes2.cpp b/src/GCodes/GCodes2.cpp index 2623cead..0ece485b 100644 --- a/src/GCodes/GCodes2.cpp +++ b/src/GCodes/GCodes2.cpp @@ -4278,7 +4278,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx case 906: // Set/report Motor currents case 913: // Set/report motor current percent -#if HAS_SMART_DRIVERS +#if HAS_SMART_DRIVERS || SUPPORT_CAN_EXPANSION case 917: // Set/report standstill motor current percentage #endif { @@ -4339,7 +4339,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeEx else { reply.copy( (code == 913) ? "Motor current % of normal - " -#if HAS_SMART_DRIVERS +#if HAS_SMART_DRIVERS || SUPPORT_CAN_EXPANSION : (code == 917) ? "Motor standstill current % of normal - " #endif : "Motor current (mA) - " diff --git a/src/Networking/ESP8266WiFi/WiFiInterface.cpp b/src/Networking/ESP8266WiFi/WiFiInterface.cpp index 50c50f62..9e08438b 100644 --- a/src/Networking/ESP8266WiFi/WiFiInterface.cpp +++ b/src/Networking/ESP8266WiFi/WiFiInterface.cpp @@ -93,10 +93,9 @@ constexpr SSPChannel ESP_SPI = SSP0; # include "matrix/matrix.h" #endif -const uint32_t WiFiResponseTimeoutMillis = 200; // SPI timeout when when the ESP does not have to write to flash memory -const uint32_t WiFiTransferTimeoutMillis = 60; // Christian measured this at 29 to 31ms when the ESP has to write to flash memory +const uint32_t WiFiResponseTimeoutMillis = 500; // Timeout includes time-intensive flash-access operations; highest measured is 234 ms. const uint32_t WiFiWaitReadyMillis = 100; -const uint32_t WiFiStartupMillis = 300; +const uint32_t WiFiStartupMillis = 8000; const uint32_t WiFiStableMillis = 100; const unsigned int MaxHttpConnections = 4; @@ -577,6 +576,8 @@ void WiFiInterface::Start() noexcept transferAlreadyPendingCount = readyTimeoutCount = responseTimeoutCount = 0; lastTickMillis = millis(); + lastDataReadyPinState = 0; + risingEdges = 0; SetState(NetworkState::starting1); } @@ -613,13 +614,31 @@ void WiFiInterface::Spin() noexcept { case NetworkState::starting1: { + const bool currentDataReadyPinState = digitalRead(EspDataReadyPin); + if (currentDataReadyPinState != lastDataReadyPinState) + { + if (currentDataReadyPinState && risingEdges < 10) + { + risingEdges++; + } + lastDataReadyPinState = currentDataReadyPinState; + } + // The ESP toggles CS before it has finished starting up, so don't look at the CS signal too soon const uint32_t now = millis(); - if (now - lastTickMillis >= WiFiStartupMillis) + if (risingEdges >= 2) // the first rising edge is the one coming out of reset { lastTickMillis = now; SetState(NetworkState::starting2); } + else + { + if (now - lastTickMillis >= WiFiStartupMillis) // time wait expired + { + platform.Message(NetworkInfoMessage, "WiFi module disabled - start timed out\n"); + SetState(NetworkState::disabled); + } + } } break; diff --git a/src/Networking/ESP8266WiFi/WiFiInterface.h b/src/Networking/ESP8266WiFi/WiFiInterface.h index 18fac5bc..5776f1e6 100644 --- a/src/Networking/ESP8266WiFi/WiFiInterface.h +++ b/src/Networking/ESP8266WiFi/WiFiInterface.h @@ -120,6 +120,8 @@ private: Platform& platform; uint32_t lastTickMillis; + bool lastDataReadyPinState; + uint8_t risingEdges; struct MessageBufferOut { diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 966906b5..9c392fb1 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -659,7 +659,7 @@ void Platform::Init() noexcept driveDriverBits[drive] = 0; motorCurrents[drive] = 0.0; motorCurrentFraction[drive] = 1.0; -#if HAS_SMART_DRIVERS +#if HAS_SMART_DRIVERS || SUPPORT_CAN_EXPANSION standstillCurrentPercent[drive] = DefaultStandstillCurrentPercent; #endif microstepping[drive] = 16 | 0x8000; // x16 with interpolation @@ -2666,7 +2666,7 @@ GCodeResult Platform::SetMotorCurrent(size_t axisOrExtruder, float currentOrPerc motorCurrentFraction[axisOrExtruder] = constrain<float>(0.01 * currentOrPercent, 0.0, 1.0); break; -#if HAS_SMART_DRIVERS +#if HAS_SMART_DRIVERS || SUPPORT_CAN_EXPANSION case 917: standstillCurrentPercent[axisOrExtruder] = constrain<float>(currentOrPercent, 0.0, 100.0); break; @@ -2848,7 +2848,7 @@ int Platform::GetMotorCurrent(size_t drive, int code) const noexcept rslt = motorCurrentFraction[drive] * 100.0; break; -#if HAS_SMART_DRIVERS +#if HAS_SMART_DRIVERS || SUPPORT_CAN_EXPANSION case 917: rslt = standstillCurrentPercent[drive]; break; diff --git a/src/Version.h b/src/Version.h index a174fe63..44414953 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.2rc2+" +# define MAIN_VERSION "3.4.2rc3" # ifdef USE_CAN0 # define VERSION_SUFFIX "(CAN0)" # else |