xblax / flashforge_ad5m_klipper_mod

Unoffical mod for Flashforge Adventurer 5M (Pro) 3D printers to run Moonraker, custom Klipper, Mainsail & Fluidd
GNU General Public License v3.0
83 stars 4 forks source link

Host temperature #124

Open Rewwan opened 1 month ago

Rewwan commented 1 month ago

How can I add a temperature display for the temperature sensor built into t113-s3?

consp commented 1 month ago

You'd need to add lm-sensors to the build system but if I'm not mistaken the sensor is not included in the flashforge kernel (which is still in use) if I remember correctly and might also need the kernel module for it (which also needs to be compiled). @xblax do you know if it needs another module?

Afterwards you could add it to klipper.

@xblax was there a reason for not including lm-sensors? It's a bit bloat but might be nice to have an indication of the temperature of the back of the system. Not that I expect the thing to get hot or be bothered by it anyway since it's a low-power embedded proc.

xblax commented 1 month ago

lm-sensors in Buildroot does not help, I already tried that - no sensor is found. I think I also looked in to the Kernel source to see if a missing module could be compiled, but did not find an easy solution.

Afaik the CPU temp sensor would have to be configured in the device tree: https://www.kernel.org/doc/Documentation/devicetree/bindings/thermal/thermal.txt

I pretty much concluded that it's not worth the effort.

consp commented 1 month ago
        ths@02009400 {
            compatible = "allwinner,sun8iw20p1-ths";
            reg = <0x00 0x2009400 0x00 0x400>;
            clocks = <0x02 0x54>;
            clock-names = "bus";
            resets = <0x02 0x23>;
            nvmem-cells = <0x63>;
            nvmem-cell-names = "calibration";
            #thermal-sensor-cells = <0x01>;
        };

It's present in the device tree, maybe it could work. No thermal zone is defined though.

10603225      0xA1CAD9        Unix path: /home/linux/work/hard_t113_s3/t113/T113/T113-Linux-Auto-v1.1/kernel/linux-5.4/drivers/thermal/of-thermal.c
10604169      0xA1CE89        Unix path: /home/linux/work/hard_t113_s3/t113/T113/T113-Linux-Auto-v1.1/kernel/linux-5.4/drivers/thermal/cpu_cooling.c

Are compiled in (don't have the config right now), I'd expect also to have had sun8i_thermal driver in there, if not it might not yet have been included in the kernel. Was added jan-2023 afaik. (note: t113/d1 support was added then)

Rewwan commented 1 month ago
      ths@02009400 {
          compatible = "allwinner,sun8iw20p1-ths";
          reg = <0x00 0x2009400 0x00 0x400>;
          clocks = <0x02 0x54>;
          clock-names = "bus";
          resets = <0x02 0x23>;
          nvmem-cells = <0x63>;
          nvmem-cell-names = "calibration";
          #thermal-sensor-cells = <0x01>;
      };

It's present in the device tree, maybe it could work. No thermal zone is defined though.

10603225      0xA1CAD9        Unix path: /home/linux/work/hard_t113_s3/t113/T113/T113-Linux-Auto-v1.1/kernel/linux-5.4/drivers/thermal/of-thermal.c
10604169      0xA1CE89        Unix path: /home/linux/work/hard_t113_s3/t113/T113/T113-Linux-Auto-v1.1/kernel/linux-5.4/drivers/thermal/cpu_cooling.c

Are compiled in (don't have the config right now), I'd expect also to have had sun8i_thermal driver in there, if not it might not yet have been included in the kernel. Was added jan-2023 afaik. (note: t113/d1 support was added then)

So there is hope?

consp commented 1 month ago

So there is hope?

Not really.

Just looked into the kernel code and sunxi_thermal is compiled into the kernel, the device tree entry is there yet the /sys entry it's not populated so my guess would be the configuration is wrong. It will probably send some messages very ealy in kernel boot but that's hard to find out as /tmp is not yet populated and there are no logs yet.

If someone wants to look into why it's not loading or get the early-kernel print data it might help us/you along and help would be appreciated. I'm not really bothered by it and my guess would be it's going to be a bit of work.