vintagepc / MK404

A functional Simulator for Prusa (Mini/Einsy) Rambo based printers
https://vintagepc.github.io/MK404/
GNU General Public License v3.0
69 stars 9 forks source link

[BUG] Altfan uses unsupported timer mode #202

Open vintagepc opened 4 years ago

vintagepc commented 4 years ago

Describe the bug Altfan uses mode 9 on timer 4. This is unsupported by SimAVR.

To Reproduce Steps to reproduce the behavior: Run altfan firmware with -vvv Observe: TIMER: avr_timer_write_ocr-4 mode 0 UNSUPPORTED

Expected behavior A functional mode 9

Additional context Maybe roll this in with a fix for the missing PC PWM mode...?? (#75 )

vintagepc commented 4 years ago

Casually poking at this, it looks like the implementation should be fairly straightforward with existing timer code as reference. The only thing I'm struggling to understand is how the specific updating of TOV or OCRs is controlled. It's a little clearer in the external clocking function but I can't make heads nor tails of the internal clock configuration for a timer.

image