Add support for gd31f303xe MCU used on Creality K1 Max (and others)

This commit is contained in:
Serge Latulippe 2025-02-25 16:44:38 -05:00
parent 1fc6d214f4
commit a7bce2f3d3

View file

@ -80,6 +80,7 @@ class PrinterTemperatureMCU:
('stm32l4', self.config_stm32g0),
('stm32h723', self.config_stm32h723),
('stm32h7', self.config_stm32h7),
('gd32f303xe', self.config_gd32f303xe),
('', self.config_unknown)]
for name, func in cfg_funcs:
if self.mcu_type.startswith(name):
@ -164,6 +165,9 @@ class PrinterTemperatureMCU:
cal_adc_110 = self.read16(0x1FF1E840) / 65535.
self.slope = (110. - 30.) / (cal_adc_110 - cal_adc_30)
self.base_temperature = self.calc_base(30., cal_adc_30)
def config_gd32f303xe(self):
self.slope = 3.3 / -.004100
self.base_temperature = self.calc_base(25., 1.45 / 3.3)
def read16(self, addr):
params = self.debug_read_cmd.send([1, addr])
return params['val']