diff options
Diffstat (limited to 'src/Duet')
-rw-r--r-- | src/Duet/Pins_Duet.h | 10 | ||||
-rw-r--r-- | src/Duet/Webserver.cpp | 31 |
2 files changed, 24 insertions, 17 deletions
diff --git a/src/Duet/Pins_Duet.h b/src/Duet/Pins_Duet.h index 768f686e..76623c34 100644 --- a/src/Duet/Pins_Duet.h +++ b/src/Duet/Pins_Duet.h @@ -7,6 +7,9 @@ #define HAS_LWIP_NETWORKING 1 #define HAS_CPU_TEMP_SENSOR 1 #define HAS_HIGH_SPEED_SD 1 +#define HAS_SMART_DRIVERS 0 +#define HAS_VOLTAGE_MONITOR 0 +#define ACTIVE_LOW_HEAT_ON 1 const size_t NumFirmwareUpdateModules = 1; #define IAP_UPDATE_FILE "iap.bin" @@ -40,9 +43,9 @@ const size_t NUM_SERIAL_CHANNELS = 3; // The number of serial IO channels (USB #define SERIAL_AUX_DEVICE Serial #define SERIAL_AUX2_DEVICE Serial1 -// The numbers of entries in each array must correspond with the values of DRIVES, AXES, or HEATERS. Set values to -1 to flag unavailability. +// The numbers of entries in each array must correspond with the values of DRIVES, AXES, or HEATERS. Set values to NoPin to flag unavailability. -// DRIVES +// Drives const Pin ENABLE_PINS[DRIVES] = { 29, 27, X1, X0, 37, X8, 50, 47, X13 }; const Pin STEP_PINS[DRIVES] = { 14, 25, 5, X2, 41, 39, X4, 49, X10 }; @@ -61,9 +64,6 @@ const float STEPPER_DAC_VOLTAGE_RANGE = 2.02; // Stepper motor current ref const float STEPPER_DAC_VOLTAGE_OFFSET = -0.025; // Stepper motor current offset voltage for E1 if using a DAC // HEATERS - -const bool HEAT_ON = false; // false for inverted heater (e.g. Duet v0.6), true for not (e.g. Duet v0.4) - const Pin TEMP_SENSE_PINS[Heaters] = { 5, 4, 0, 7, 8, 9, 11 }; // Analogue pin numbers const Pin HEAT_ON_PINS[Heaters] = { 6, X5, X7, 7, 8, 9, X17 }; // Heater Channel 7 (pin X17) is shared with Fan1 diff --git a/src/Duet/Webserver.cpp b/src/Duet/Webserver.cpp index 27392548..bbb431a3 100644 --- a/src/Duet/Webserver.cpp +++ b/src/Duet/Webserver.cpp @@ -831,10 +831,14 @@ void Webserver::HttpInterpreter::SendJsonResponse(const char* command) return; } - if (StringEquals(command, "download") && StringEquals(qualifiers[0].key, "name")) + if (StringEquals(command, "download")) { - SendFile(qualifiers[0].value, false); - return; + const char* const filename = GetKeyValue("name"); + if (filename != nullptr) + { + SendFile(filename, false); + return; + } } } @@ -905,11 +909,12 @@ void Webserver::HttpInterpreter::GetJsonResponse(const char* request, OutputBuff if (Authenticate()) { // See if we can update the current RTC date and time - if (numQualKeys > 1 && StringEquals(qualifiers[1].key, "time") && !platform->IsDateTimeSet()) + const char* const timeString = GetKeyValue("time"); + if (timeString != nullptr && !platform->IsDateTimeSet()) { struct tm timeInfo; memset(&timeInfo, 0, sizeof(timeInfo)); - if (strptime(qualifiers[1].value, "%Y-%m-%dT%H:%M:%S", &timeInfo) != nullptr) + if (strptime(timeString, "%Y-%m-%dT%H:%M:%S", &timeInfo) != nullptr) { time_t newTime = mktime(&timeInfo); platform->SetDateTime(newTime); @@ -1527,7 +1532,8 @@ bool Webserver::HttpInterpreter::ProcessMessage() || (commandWords[1][0] == '/' && StringEquals(commandWords[1] + 1, KO_START "upload")); if (isUploadRequest) { - if (numQualKeys > 0 && StringEquals(qualifiers[0].key, "name")) + const char* const filename = GetKeyValue("name"); + if (filename != nullptr) { // We cannot upload more than one file at once if (IsUploading()) @@ -1537,7 +1543,7 @@ bool Webserver::HttpInterpreter::ProcessMessage() // See how many bytes we expect to read bool contentLengthFound = false; - for(size_t i=0; i<numHeaderKeys; i++) + for (size_t i = 0; i < numHeaderKeys; i++) { if (StringEquals(headers[i].key, "Content-Length")) { @@ -1554,18 +1560,19 @@ bool Webserver::HttpInterpreter::ProcessMessage() } // Start a new file upload - FileStore *file = platform->GetFileStore(FS_PREFIX, qualifiers[0].value, OpenMode::write); - if (!StartUpload(file, qualifiers[0].value)) + FileStore *file = platform->GetFileStore(FS_PREFIX, filename, OpenMode::write); + if (!StartUpload(file, filename)) { return RejectMessage("could not start file upload"); } // Try to get the last modified file date and time - if (numQualKeys > 1 && StringEquals(qualifiers[1].key, "time")) + const char* const lastModifiedString = GetKeyValue("time"); + if (lastModifiedString != nullptr) { struct tm timeInfo; memset(&timeInfo, 0, sizeof(timeInfo)); - if (strptime(qualifiers[1].value, "%Y-%m-%dT%H:%M:%S", &timeInfo) != nullptr) + if (strptime(lastModifiedString, "%Y-%m-%dT%H:%M:%S", &timeInfo) != nullptr) { fileLastModified = mktime(&timeInfo); } @@ -1581,7 +1588,7 @@ bool Webserver::HttpInterpreter::ProcessMessage() if (reprap.Debug(moduleWebserver)) { - platform->MessageF(UsbMessage, "Start uploading file %s length %lu\n", qualifiers[0].value, postFileLength); + platform->MessageF(UsbMessage, "Start uploading file %s length %lu\n", filename, postFileLength); } uploadedBytes = 0; |