Просмотр исходного кода

✨ Creality STM32F401RE board (e.g., Ender-5 S1) (#25773)

Scott Lahteine 1 год назад
Родитель
Сommit
e1f6435d44

+ 1 - 0
Marlin/Configuration.h

@@ -462,6 +462,7 @@
  *    11 : 100kΩ Keenovo AC silicone mats, most Wanhao i3 machines - beta 3950, 1%
  *    12 : 100kΩ Vishay 0603 SMD NTCS0603E3104FXT (#8) - calibrated for Makibox hot bed
  *    13 : 100kΩ Hisens up to 300°C - for "Simple ONE" & "All In ONE" hotend - beta 3950, 1%
+ *    14 : 100kΩ  (R25), 4092K (beta25), 4.7kΩ pull-up, bed thermistor as used in Ender-5 S1
  *    15 : 100kΩ Calibrated for JGAurora A5 hotend
  *    18 : 200kΩ ATC Semitec 204GT-2 Dagoma.Fr - MKS_Base_DKU001327
  *    22 : 100kΩ GTM32 Pro vB - hotend - 4.7kΩ pullup to 3.3V and 220Ω to analog input

+ 1 - 0
Marlin/src/core/boards.h

@@ -449,6 +449,7 @@
 #define BOARD_FYSETC_SPIDER_KING407   5243  // FYSETC Spider King407 (STM32F407ZG)
 #define BOARD_MKS_SKIPR_V1            5244  // MKS SKIPR v1.0 all-in-one board (STM32F407VE)
 #define BOARD_TRONXY_V10              5245  // TRONXY V10 (STM32F446ZE)
+#define BOARD_CREALITY_F401RE         5246  // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1
 
 //
 // ARM Cortex-M7

+ 4 - 0
Marlin/src/gcode/gcode.cpp

@@ -1061,6 +1061,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
         case 422: M422(); break;                                  // M422: Set Z Stepper automatic alignment position using probe
       #endif
 
+      #if ENABLED(OTA_FIRMWARE_UPDATE)
+        case 936: M936(); break;                                  // M936: OTA update firmware.
+      #endif
+
       #if SPI_FLASH_BACKUP
         case 993: M993(); break;                                  // M993: Backup SPI Flash to SD
         case 994: M994(); break;                                  // M994: Load a Backup from SD to SPI Flash

+ 5 - 0
Marlin/src/gcode/gcode.h

@@ -300,6 +300,7 @@
  * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
  * M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING)
  * M919 - Get or Set motor Chopper Times (time_off, hysteresis_end, hysteresis_start) using axis codes XYZE, etc. If no parameters are given, report. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660)
+ * M936 - OTA update firmware. (Requires OTA_FIRMWARE_UPDATE)
  * M951 - Set Magnetic Parking Extruder parameters. (Requires MAGNETIC_PARKING_EXTRUDER)
  * M3426 - Read MCP3426 ADC over I2C. (Requires HAS_MCP3426_ADC)
  * M7219 - Control Max7219 Matrix LEDs. (Requires MAX7219_GCODE)
@@ -1199,6 +1200,10 @@ private:
     static void M928();
   #endif
 
+  #if ENABLED(OTA_FIRMWARE_UPDATE)
+    static void M936();
+  #endif
+
   #if ENABLED(MAGNETIC_PARKING_EXTRUDER)
     static void M951();
   #endif

+ 72 - 0
Marlin/src/gcode/ota/M936.cpp

@@ -0,0 +1,72 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+#include "../../inc/MarlinConfig.h"
+
+#if ENABLED(OTA_FIRMWARE_UPDATE)
+
+#include "../gcode.h"
+#include "../../libs/BL24CXX.h"
+
+#if ENABLED(CREALITY_RTS)
+  #include "../../lcd/rts/lcd_rts.h"
+#endif
+
+#define OTA_FLAG_EEPROM 90
+
+//#define DEBUG_OUT 1
+#include "../../core/debug_out.h"
+
+/**
+ * M936: Set one of the OTA update flags.
+ *   V2 = Upgrade the motherboard firmware
+ *   V3 = Upgrade the RTS controller firmware
+ */
+void GcodeSuite::M936() {
+  static uint8_t ota_update_flag = 0x00;
+  const int16_t ota = parser.intval('V', -1);
+  switch (ota) {
+    case 2:
+      // Set the OTA board firmware upgrade flag ahead of reboot.
+      ota_update_flag = 0x01;
+      DEBUG_ECHOLNPGM("Motherboard upgrade flag set");
+      TERN_(CREALITY_RTS, RTS_Error(Error_205));
+      break;
+
+    #if ENABLED(CREALITY_RTS)
+      case 3:
+        // Set the OTA screen firmware upgrade flag ahead of reboot.
+        ota_update_flag = 0x02;
+        DEBUG_ECHOLNPGM("DWIN upgrade flag set");
+        TERN_(CREALITY_RTS, RTS_Error(Error_206));
+        break;
+    #endif
+  }
+
+  switch (ota) {
+    case 2: TERN_(CREALITY_RTS, case 3:)
+      BL24CXX::write(OTA_FLAG_EEPROM, &ota_update_flag, sizeof(ota_update_flag));
+      safe_delay(100);
+      hal.reboot();
+  }
+}
+
+#endif // OTA_FIRMWARE_UPDATE

+ 4 - 0
Marlin/src/inc/Conditionals_post.h

@@ -65,6 +65,10 @@
   #undef IIC_BL24CXX_EEPROM
 #endif
 
+#if DISABLED(IIC_BL24CXX_EEPROM)
+  #undef OTA_FIRMWARE_UPDATE
+#endif
+
 #ifdef TEENSYDUINO
   #undef max
   #define max(a,b) ((a)>(b)?(a):(b))

+ 7 - 0
Marlin/src/inc/Warnings.cpp

@@ -749,3 +749,10 @@
 #if SDSORT_CACHE_LPC1768_WARNING
   #warning "SDCARD_SORT_ALPHA sub-options overridden for LPC1768 with DOGM LCD SCK overlap."
 #endif
+
+/**
+ * Ender-5 S1 bootloader
+ */
+#ifdef STM32F4_UPDATE_FOLDER
+  #warning "Place the firmware bin file in a folder named 'STM32F4_UPDATE' on the SD card. Install with 'M936 V2'."
+#endif

+ 4 - 0
Marlin/src/module/thermistor/thermistor_1.h

@@ -23,6 +23,10 @@
 
 // R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
 constexpr temp_entry_t temptable_1[] PROGMEM = {
+  { OV(  18), 320 },
+  { OV(  19), 315 },
+  { OV(  20), 310 },
+  { OV(  22), 305 },
   { OV(  23), 300 },
   { OV(  25), 295 },
   { OV(  27), 290 },

+ 85 - 0
Marlin/src/module/thermistor/thermistor_14.h

@@ -0,0 +1,85 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+// R25 = 100 kOhm, beta25 = 4092 K, 4.7 kOhm pull-up, bed thermistor
+const temp_entry_t temptable_14[] PROGMEM = {
+  { OV(  23), 275 },
+  { OV(  25), 270 },
+  { OV(  27), 265 },
+  { OV(  28), 260 },
+  { OV(  31), 255 },
+  { OV(  33), 250 },
+  { OV(  35), 245 },
+  { OV(  38), 240 },
+  { OV(  41), 235 },
+  { OV(  44), 230 },
+  { OV(  47), 225 },
+  { OV(  52), 220 },
+  { OV(  56), 215 },
+  { OV(  62), 210 },
+  { OV(  68), 205 },
+  { OV(  74), 200 },
+  { OV(  81), 195 },
+  { OV(  90), 190 },
+  { OV(  99), 185 },
+  { OV( 108), 180 },
+  { OV( 121), 175 },
+  { OV( 133), 170 },
+  { OV( 147), 165 },
+  { OV( 162), 160 },
+  { OV( 180), 155 },
+  { OV( 199), 150 },
+  { OV( 219), 145 },
+  { OV( 243), 140 },
+  { OV( 268), 135 },
+  { OV( 296), 130 },
+  { OV( 326), 125 },
+  { OV( 358), 120 },
+  { OV( 398), 115 },
+  { OV( 435), 110 },
+  { OV( 476), 105 },
+  { OV( 519), 100 },
+  { OV( 566),  95 },
+  { OV( 610),  90 },
+  { OV( 658),  85 },
+  { OV( 703),  80 },
+  { OV( 742),  75 },
+  { OV( 773),  70 },
+  { OV( 807),  65 },
+  { OV( 841),  60 },
+  { OV( 871),  55 },
+  { OV( 895),  50 },
+  { OV( 918),  45 },
+  { OV( 937),  40 },
+  { OV( 954),  35 },
+  { OV( 968),  30 },
+  { OV( 978),  25 },
+  { OV( 985),  20 },
+  { OV( 993),  15 },
+  { OV( 999),  10 },
+  { OV(1004),   5 },
+  { OV(1008),   0 },
+  { OV(1012),  -5 },
+  { OV(1016), -10 },
+  { OV(1020), -15 }
+};

+ 3 - 0
Marlin/src/module/thermistor/thermistors.h

@@ -109,6 +109,9 @@ typedef struct { raw_adc_t value; celsius_t celsius; } temp_entry_t;
 #if ANY_THERMISTOR_IS(13) // beta25 = 4100 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "Hisens"
   #include "thermistor_13.h"
 #endif
+#if ANY_THERMISTOR_IS(14) // beta25 = 4092 K, R25 = 100 kOhm, Pull-up = 4.7 kOhm, "EPCOS" for hot bed
+  #include "thermistor_14.h"
+#endif
 #if ANY_THERMISTOR_IS(15) // JGAurora A5 thermistor calibration
   #include "thermistor_15.h"
 #endif

Некоторые файлы не были показаны из-за большого количества измененных файлов