Skip to content

Commit 5db5043

Browse files
committed
Version 2.0 provisional
New features/changed behaviour: - if config.g is not found then config.g.bak is run instead of default.g - added error codes to SD card access error reports - rr_files, rr_filelist, M20 S2 and M20 S3 now provide for retrieving the list if files in chunks, using a "first" parameter in rr_files/rr_filelist or "R" parameter in M20 S2/S2, and a "next" field in the response Bug fixes: - In absolute extrusion mode, the first move when resuming after a pause didn't extrude - DWC didn't give the option to load a filament when no filament was loaded
1 parent 75c87d6 commit 5db5043

File tree

15 files changed

+206
-180
lines changed

15 files changed

+206
-180
lines changed

src/BugList.txt

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Fixes in RC5:
162162
- [done] Extra axes were ignored in G2/G3 moves
163163
- [done] DWC and the Duet could deadlock if the Duet ran out of output buffers
164164

165-
Fixes post RC5:
165+
Fixes in RC6:
166166
- [done] M569 report includes chopper configuration register for smart drivers
167167
- [done] If getting file info timed out it didn't close the file
168168
- [done] DHT sensor task was running out of stack space
@@ -171,50 +171,69 @@ Fixes post RC5:
171171
- [done] Multiple DHT sensor support
172172
- [done] Support DHT sensor on Duet Maestro
173173
- [done] Pausing between the segments of a segmented move didn't happen even if the jerk settings were high enough
174-
- [done - need to test filament monitors!!!] If filament monitors were deleted or the type changed, this could result in an exception
175-
- [seems ok] Test Upload & print function, see https://forum.duet3d.com/topic/5394/new-firmware-2-0rc5-available/52
174+
- [done, ok] If filament monitors were deleted or the type changed, this could result in an exception
175+
- [done] Support S0/S1 for simple filament monitors
176176
- [done, test] When step rate limiting happens, various problems, see https://forum.duet3d.com/topic/5445/unable-to-run-128-or-256-microstepping (adjust move start time)
177-
- [can't reproduce] Kulitorum report that first move after a pause doesn't extrude, https://forum.duet3d.com/topic/5408/does-not-extrude-first-g1-after-a-pause/7
178177
- [done, test] when the SD card is removed it says 1 file was invalidated even if it was more
179178
- [done, ok] When SD card is removed during a print we get lots of internal error messages, and no "print abandoned" or similar message, also the heaters stay on
180179
- [done] Emergency stop should turn off all spindles
181-
- [looks like was caused by using M502] Report that filaments no longer work
182180

181+
- [seems ok] Test Upload & print function, see https://forum.duet3d.com/topic/5394/new-firmware-2-0rc5-available/52
182+
183+
Fixes in release 2.0:
184+
- [done, test] Kulitorum report that first move after a pause doesn't extrude, https://forum.duet3d.com/topic/5408/does-not-extrude-first-g1-after-a-pause/7
185+
- [done] Add error codes to SD card error messages
186+
- [tested, documentation error] chrishamm says DHT sensors on CS pins 1-4 don't work
187+
- [done] add facility to return rr_filelist in chunks?
188+
- [done] load config.g.bak if config.g not present, not default.g
189+
- [done] can't load filaments because DWC doesn't give the option unless a filament is already loaded
190+
- look at wifi disconnect issue, https://forum.duet3d.com/topic/4341/wifi-module-keeps-disconnecting/64
191+
192+
Planned for 2.01:
193+
- Bezier speed curves or other S-curve acceleration, e.g. look at https://github.com/MarlinFirmware/Marlin/pull/10373/files
194+
- Option to send M280 servo commands just a few times instead of continuously, for E3D and BLTouch
195+
- Recovery from SD card errors during a print (Dan)
196+
- Danny's modified SCARA kinematics (workpiece is on a plate, extruder is fixed)
197+
- Laser support via G1 S parameter, see https://forum.duet3d.com/topic/4702/laser-cnc-support-in-rrf-gcode-semantics/4
198+
- Look at pushover notification support, https://forum.duet3d.com/topic/169/notification-via-pushover-or-other-service/45
183199
- M3 R parameter so it can restore the spinder/laser after a pause (https://forum.duet3d.com/topic/5418/cnc-laser-m3-unpause-r-parameter)
200+
- M81: don't give low voltage warnings when main power has just been turned off
201+
- Does bltouch need a default recovery time?
202+
- Should bltouch use digital probe mode? Some users having problems with P25 in G31 command.
203+
- M584 when assigning a drive, unmap any existing assignment. Also allow an axis to be mapped to driver -1.
204+
- Add S4 option to G1 command, like S1 but no endstop checks (needed for CoreXY, CoreXZ)
184205
- CNC: look at G17/18/19, see https://forum.duet3d.com/topic/4669/ooznest-workbee-screw-driven
185-
- PanelDue won't connect if VIN velow minimum for stepper motors [PanelDue firmware needs to recognise status 'O']
206+
- M569 command to allow selection of smart/dumb driver, also allow all 12 drivers to be smart
207+
- M569 TOFF parameter, https://forum.duet3d.com/topic/5392/does-m906-set-rms-or-peak-current/28
208+
- Apostrophe in quoted filename: can we make apostrophe special in SSIDs/passwords but not filenames?
209+
- If wifi module gets stuck in starting or changing mode state, reset it again
210+
- If wifi disconnects when in client mode, keep retrying the connection
211+
212+
Other (some of these may be in 2.01):
213+
- Update PanelDue firmware via Duet
214+
- Use Heat task to read DHT sensors?
215+
- Add option R4 to M915 command, to do an emergency stop (useful for Z motor)
216+
- GCodes corresponding to rr_move and rr_mkdir, https://forum.duet3d.com/topic/5470/firmware-2-0rc6-and-1-21-1rc6-released/13
186217
- Add parameter to M116 to specify acceptable temperature difference
187-
- Laser support, see https://forum.duet3d.com/topic/4702/laser-cnc-support-in-rrf-gcode-semantics/4
188-
- Pushover notification support, https://forum.duet3d.com/topic/169/notification-via-pushover-or-other-service/45
189218
- support M205 for setting jerk
190219
- support G12 clean tool?
191220
- Add fan PWM limit, https://forum.duet3d.com/topic/5370/m106-feature-request-limit-max-pwm-parameter/4
192221
- M116 extra "close enough" parameter
193-
- Danny's modified SCARA kinematics (workpiece is on a plate, extruder is fixed)
194-
- Look at Bezier speed curves or other S-curve acceleration, https://github.com/MarlinFirmware/Marlin/pull/10373/files
195222
- after homing, warn if outside M208 movement limits on SCARA, polar etc.
196223
- Unexpected heaters off/tool selection behaviour, https://www.duet3d.com/forum/thread.php?pid=43059#p43059
197224
- warn when using : where ; was probably meant
198225
- Error message if you attempt movement with VIN < minimum
199226
- min/max RSSI display?
200-
- save theta, phi in move and then in DDA?
201227
- report RSSI in M552?
202228
- When VIN power too low and stepper drivers turned off, flag axes as not homed?
203-
- M81: don't give low voltage warnings when main power has just been turned off
204-
- Return "Powered down" status when VIN power has never been seen or has gone down after sending M81
205229
- Auto mount main SD card when inserted
206230
- Workplace offsets are supposed to be persistant (check NIST), https://www.duet3d.com/forum/thread.php?pid=43755#p43755
207231
- At the end of a simulation, restore the original workplace coordinate selection
208-
- apostrophe in quoted filename
209232
- looks like we get a Pop underflow message when you send DWC jog commands and axes are not homed
210233
- Add warning message when print exceeds bounds
211-
- Does bltouch need a default recovery time?
212-
- Should bltouch use digital probe mode? Some users having problems with P25 in G31 command.
213-
- M584 when assigning a drive, unmap any existing assignment. Also allow an axis to be mapped to driver -1.
214-
- Add S4 option to G1 command, like S1 but no endstop checks (needed for CoreXY, CoreXZ)
215234
- When uploading while a file is being printed, don't allow the currently-printing file to be replaced
216235

217-
- if a homing command in an SD print file is aborted due to e.g. G1 Z5 in the homing file, error message should be written to both DWC and PanelDue
236+
- [check] if a homing command in an SD print file is aborted due to e.g. G1 Z5 in the homing file, error message should be written to both DWC and PanelDue
218237
- [no fault] stall detect on Z axis
219238
- Files generated by Cura doesn't detect layer changes, see https://www.duet3d.com/forum/thread.php?pid=40865#p40865
220239
- [re-test using new DuetWiFiServer] "Failed to change mode" messages after M552 S2/S0/S1 cycle
@@ -231,7 +250,6 @@ Fixes post RC5:
231250
- check that we never enable the drivers before we set vsense
232251

233252
- [don't do] Don't report the motor current for a non-existent extruder
234-
- SD card read error handling?
235253
- dual extrusion layer counting, see https://www.duet3d.com/forum/thread.php?pid=34816#p34816
236254
- M140/M190 with no P parameter sets all bed heater temperatures (same for M141/M191)
237255
- M291 to lock movement and wait for it to finish?
@@ -245,9 +263,6 @@ Fixes post RC5:
245263
- Send reduce power command to PanelDue when main power turned off?
246264
- Document multiple bed and chamber heaters
247265
- [mostly done] Check all classes for correct initialisation
248-
- sd_mmc_spi doesn't acquire/release the SPI bus. Need to change this for RTOS.
249-
- If wifi module gets stuck in starting state, reset it again
250-
- If wifi disconnects when in client mode, keep retrying the connection
251266

252267
Bug investigations:
253268
- [done] step errors, https://www.duet3d.com/forum/thread.php?pid=33741#p33741

src/Configuration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ constexpr size_t FILE_BUFFER_SIZE = 128;
259259
#define MENU_DIR "0:/menu/" // Directory for menu files
260260

261261
#define CONFIG_FILE "config.g"
262-
#define DEFAULT_FILE "default.g"
262+
#define CONFIG_BACKUP_FILE "config.g.bak"
263263
#define DEFAULT_LOG_FILE "eventlog.txt"
264264

265265
#define EOF_STRING "<!-- **EoF** -->"

src/Duet/Webserver.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -951,19 +951,23 @@ void Webserver::HttpInterpreter::GetJsonResponse(const char* request, OutputBuff
951951
else if (StringEquals(request, "filelist") && GetKeyValue("dir") != nullptr)
952952
{
953953
OutputBuffer::Release(response);
954-
response = reprap.GetFilelistResponse(GetKeyValue("dir"));
954+
const char* const firstVal = GetKeyValue("first");
955+
const unsigned int startAt = (firstVal == nullptr) ? 0 : (unsigned int)SafeStrtol(firstVal);
956+
response = reprap.GetFilelistResponse(GetKeyValue("dir"), startAt); // this may return nullptr
955957
}
956958
else if (StringEquals(request, "files"))
957959
{
960+
OutputBuffer::Release(response);
958961
const char* dir = GetKeyValue("dir");
959962
if (dir == nullptr)
960963
{
961964
dir = platform->GetGCodeDir();
962965
}
966+
const char* const firstVal = GetKeyValue("first");
967+
const unsigned int startAt = (firstVal == nullptr) ? 0 : SafeStrtol(firstVal);
963968
const char* const flagDirsVal = GetKeyValue("flagDirs");
964969
const bool flagDirs = flagDirsVal != nullptr && atoi(flagDirsVal) == 1;
965-
OutputBuffer::Release(response);
966-
response = reprap.GetFilesResponse(dir, flagDirs);
970+
response = reprap.GetFilesResponse(dir, startAt, flagDirs); // this may return nullptr
967971
}
968972
else if (StringEquals(request, "fileinfo"))
969973
{

src/GCodes/GCodes.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,11 +2115,11 @@ bool GCodes::LoadExtrusionAndFeedrateFromGCode(GCodeBuffer& gb)
21152115
moveBuffer.coords[drive] = 0.0;
21162116
}
21172117
moveBuffer.hasExtrusion = false;
2118+
moveBuffer.virtualExtruderPosition = virtualExtruderPosition; // save this before we update it
21182119

21192120
// Check if we are extruding
21202121
if (moveBuffer.isCoordinated && gb.Seen(extrudeLetter))
21212122
{
2122-
21232123
// Check that we have a tool to extrude with
21242124
Tool* const tool = reprap.GetCurrentTool();
21252125
if (tool == nullptr)
@@ -2610,7 +2610,6 @@ void GCodes::FinaliseMove(GCodeBuffer& gb)
26102610
{
26112611
moveBuffer.canPauseAfter = (moveBuffer.endStopsToCheck == 0);
26122612
moveBuffer.filePos = (&gb == fileGCode) ? gb.GetFilePosition(fileInput->BytesCached()) : noFilePosition;
2613-
moveBuffer.virtualExtruderPosition = virtualExtruderPosition;
26142613

26152614
if (totalSegments > 1)
26162615
{

src/GCodes/GCodes2.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
564564
}
565565
{
566566
const int sparam = (gb.Seen('S')) ? gb.GetIValue() : 0;
567+
const unsigned int rparam = (gb.Seen('R')) ? gb.GetUIValue() : 0;
567568
String<MaxFilenameLength> dir;
568569
if (gb.Seen('P'))
569570
{
@@ -577,7 +578,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
577578
OutputBuffer *fileResponse;
578579
if (sparam == 2)
579580
{
580-
fileResponse = reprap.GetFilesResponse(dir.c_str(), true); // Send the file list in JSON format
581+
fileResponse = reprap.GetFilesResponse(dir.c_str(), rparam, true); // send the file list in JSON format
581582
if (fileResponse == nullptr)
582583
{
583584
return false;
@@ -586,7 +587,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
586587
}
587588
else if (sparam == 3)
588589
{
589-
fileResponse = reprap.GetFilelistResponse(dir.c_str());
590+
fileResponse = reprap.GetFilelistResponse(dir.c_str(), rparam);
590591
if (fileResponse == nullptr)
591592
{
592593
return false;
@@ -597,7 +598,7 @@ bool GCodes::HandleMcode(GCodeBuffer& gb, const StringRef& reply)
597598
{
598599
if (!OutputBuffer::Allocate(fileResponse))
599600
{
600-
return false; // Cannot allocate an output buffer, try again later
601+
return false; // cannot allocate an output buffer, try again later
601602
}
602603

603604
// To mimic the behaviour of the official RepRapPro firmware:

src/Heating/Sensors/DhtSensor.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ DhtSensorHardwareInterface::DhtSensorHardwareInterface(Pin p_pin)
3939
: sensorPin(p_pin), type(DhtSensorType::none), lastResult(TemperatureError::notInitialised),
4040
lastTemperature(BAD_ERROR_TEMPERATURE), lastHumidity(BAD_ERROR_TEMPERATURE), badTemperatureCount(0)
4141
{
42+
IoPort::SetPinMode(sensorPin, INPUT_PULLUP);
4243
}
4344

4445
TemperatureError DhtSensorHardwareInterface::GetTemperatureOrHumidity(float& t, bool wantHumidity) const
@@ -117,7 +118,7 @@ GCodeResult DhtSensorHardwareInterface::Configure(TemperatureSensor *ts, unsigne
117118
return rslt;
118119
}
119120

120-
// Create a hardware interface object re the specified channel if there isn't already
121+
// Create a hardware interface object for the specified channel if there isn't already
121122
DhtSensorHardwareInterface *DhtSensorHardwareInterface::Create(unsigned int relativeChannel)
122123
{
123124
if (relativeChannel >= MaxSpiTempSensors)
@@ -170,19 +171,13 @@ void DhtSensorHardwareInterface::Interrupt()
170171
if (numPulses < ARRAY_SIZE(pulses))
171172
{
172173
const uint16_t now = Platform::GetInterruptClocks16();
173-
if (digitalRead(sensorPin))
174+
if (IoPort::ReadPin(sensorPin))
174175
{
175176
lastPulseTime = now;
176177
}
177178
else if (lastPulseTime != 0)
178179
{
179180
pulses[numPulses++] = now - lastPulseTime;
180-
#if 0
181-
if (numPulses == ARRAY_SIZE(pulses))
182-
{
183-
vTaskNotifyGiveFromISR(dhtTask->GetHandle(), nullptr); // wake up the task
184-
}
185-
#endif
186181
}
187182
}
188183
}
@@ -191,24 +186,20 @@ void DhtSensorHardwareInterface::TakeReading()
191186
{
192187
if (type != DhtSensorType::none) // if sensor has been configured
193188
{
194-
// Send start signal. See DHT datasheet for full signal diagram:
195-
// http://www.adafruit.com/datasheets/Digital%20humidity%20and%20temperature%20sensor%20AM2302.pdf
196-
pinMode(sensorPin, OUTPUT_HIGH);
197-
delay(250);
198-
199-
digitalWrite(sensorPin, LOW);
189+
// Send the start bit. This must be at least 18ms for the DHT11, 0.8ms for the DHT21, and 1ms long for the DHT22.
190+
IoPort::SetPinMode(sensorPin, OUTPUT_LOW);
200191
delay(20);
201192

202193
{
203194
TaskCriticalSectionLocker lock; // make sure the Heat task doesn't interrupt the sequence
204195

205196
// End the start signal by setting data line high. the sensor will respond with the start bit in 20 to 40us.
206197
// We need only force the data line high long enough to charge the line capacitance, after that the pullup resistor keeps it high.
207-
digitalWrite(sensorPin, HIGH); // this will generate an interrupt, but we will ignore it
198+
IoPort::WriteDigital(sensorPin, HIGH); // this will generate an interrupt, but we will ignore it
208199
delayMicroseconds(3);
209200

210201
// Now start reading the data line to get the value from the DHT sensor
211-
pinMode(sensorPin, INPUT_PULLUP);
202+
IoPort::SetPinMode(sensorPin, INPUT_PULLUP);
212203

213204
// It appears that switching the pin to an output disables the interrupt, so we need to call attachInterrupt here
214205
// We are likely to get an immediate interrupt at this point corresponding to the low-to-high transition. We must ignore this.

src/Libraries/Fatfs/ff.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ typedef struct {
178178

179179
typedef enum {
180180
FR_OK = 0, /* (0) Succeeded */
181-
FR_DISK_ERR, /* (1) A hard error occured in the low level disk I/O layer */
181+
FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
182182
FR_INT_ERR, /* (2) Assertion failed */
183183
FR_NOT_READY, /* (3) The physical drive cannot work */
184184
FR_NO_FILE, /* (4) Could not find the file */
185185
FR_NO_PATH, /* (5) Could not find the path */
186186
FR_INVALID_NAME, /* (6) The path name format is invalid */
187-
FR_DENIED, /* (7) Acces denied due to prohibited access or directory full */
188-
FR_EXIST, /* (8) Acces denied due to prohibited access */
187+
FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
188+
FR_EXIST, /* (8) Access denied due to prohibited access */
189189
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
190190
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
191191
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */

src/Networking/HttpResponder.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,23 @@ bool HttpResponder::GetJsonResponse(const char* request, OutputBuffer *&response
533533
else if (StringEquals(request, "filelist") && GetKeyValue("dir") != nullptr)
534534
{
535535
OutputBuffer::Release(response);
536-
response = reprap.GetFilelistResponse(GetKeyValue("dir")); // this may return nullptr
536+
const char* const firstVal = GetKeyValue("first");
537+
const unsigned int startAt = (firstVal == nullptr) ? 0 : (unsigned int)SafeStrtol(firstVal);
538+
response = reprap.GetFilelistResponse(GetKeyValue("dir"), startAt); // this may return nullptr
537539
}
538540
else if (StringEquals(request, "files"))
539541
{
542+
OutputBuffer::Release(response);
540543
const char* dir = GetKeyValue("dir");
541544
if (dir == nullptr)
542545
{
543546
dir = GetPlatform().GetGCodeDir();
544547
}
548+
const char* const firstVal = GetKeyValue("first");
549+
const unsigned int startAt = (firstVal == nullptr) ? 0 : SafeStrtol(firstVal);
545550
const char* const flagDirsVal = GetKeyValue("flagDirs");
546551
const bool flagDirs = flagDirsVal != nullptr && SafeStrtol(flagDirsVal) == 1;
547-
OutputBuffer::Release(response);
548-
response = reprap.GetFilesResponse(dir, flagDirs); // this may return nullptr
552+
response = reprap.GetFilesResponse(dir, startAt, flagDirs); // this may return nullptr
549553
}
550554
else if (StringEquals(request, "fileinfo"))
551555
{

src/OutputMemory.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,17 @@ size_t OutputBuffer::cat(StringRef &str)
231231
}
232232

233233
// Encode a string in JSON format and append it to a string buffer and return the number of bytes written
234-
size_t OutputBuffer::EncodeString(const char *src, size_t srcLength, bool allowControlChars, bool encapsulateString)
234+
size_t OutputBuffer::EncodeString(const char *src, size_t srcLength, bool allowControlChars, bool encapsulateString, bool prependAsterisk)
235235
{
236236
size_t bytesWritten = 0;
237237
if (encapsulateString)
238238
{
239239
bytesWritten += cat('"');
240240
}
241+
if (prependAsterisk)
242+
{
243+
bytesWritten += cat('*');
244+
}
241245

242246
if (srcLength != 0)
243247
{

src/OutputMemory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class OutputBuffer
5454
size_t cat(const char *src, size_t len);
5555
size_t cat(StringRef &str);
5656

57-
size_t EncodeString(const char *src, size_t srcLength, bool allowControlChars, bool encapsulateString = true);
57+
size_t EncodeString(const char *src, size_t srcLength, bool allowControlChars, bool encapsulateString = true, bool prependAsterisk = false);
5858
size_t EncodeString(const StringRef& str, bool allowControlChars, bool encapsulateString = true);
5959
size_t EncodeReply(OutputBuffer *src, bool allowControlChars);
6060

0 commit comments

Comments
 (0)