update code base to Marlin 2.1.1 #364
Reference in New Issue
Block a user
No description provided.
Delete Branch "marlin-2.1.1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
This PR updates the upstream sources to Marlin 2.1.1
Changes
Z_DRIVER_TYPE
andZ2_DRIVER_TYPE
anycubic_touchscreen
code with relevant changesTested
The firmware builds for all targets
I've tested the
MEGA_P_DGUS_BLT_10
target on my printer, including special menu, autoleveling and laser. Works so far.Benefits
The updates introduces new features and bugfixes in Marlin. It also brings this project closer to upstream for future development.
Configurations
The configuration files have been updated and hopefully all customization remain functional.
I have enabled
FAN_SOFT_PWM
withSOFT_PWM_SCALE
value 2 (~15Hz), because of conflicts withSPEAKER
(same timer for hardware PWM).This has been an issue ever since that is just rarely is noticed (strange speaker sounds when fan speed changes during playback or short interrupt of fan speed), but latest sanity checks prevent compilation.
We hat soft PWM enabled in 1.4.0 (
d19dbf0be5
) and disabled it again in 1.4.1 (7071629534
), so we probably need some further testing here.Related Issues
None.
Side note
I have done complete rabase of this repository on top of Marlin 2.0.5.3 where it all started: https://github.com/stklcode/Marlin/tree/knutwurst Makes merging upstream changes and conflict resolution much easier with proper tooling, so probably a well spent hour.
For this PR I have applied patches derived from the "knutwurst-next" branch where a real merge of 2.1.1 was done: https://github.com/stklcode/Marlin/tree/knutwurst-next
Awesome!
Let me take a look at everything and roll out some tests to give some feedback before merging the PR into master.
Sure, take your time.
I only have one printer to test and only did a single real print so far (and some dummy test-sequences). But especially for the Chiron implementation the changes were made blindly, so I can only say it compiles...
For the soft PWM changes I honestly can't remember if I experienced the ticking issues back in 1.4.0, so no idea if it is still present for anyone. Disabling the sanity check, i.e. tolerate the conflict as we did before, would be another possibility of course.
After all, I only own a Mega S and cannot test the Chiron implementation. But I know some people who do that. For now, I'll go through the code myself, then I'll compile everything and then have it tested.
Let's write on Discord if you like.
I tested it and now the cooling fan is pulsing slowly, for example setting the fan speed to 50%
M106 S128
makes my fan go on and off rapidly, as if the pulse length is wrong, 100%M106 S255
seems to work thoughYou are right, seems too slow.
SOFT_PWM_SCALE
is not set, we probably should use 1 or 2 (i.e. 2x or 4x speed).The previous attempt in 1.4 was 5 (32x speed) with dithering caused issues, so we should figure out something in between.
Yeah, I was about to say,
SOFT_PWM_SCALE
wasn't enabled by default which I just did now, setting it to2
seems to work fine.If you activate SOFT_PWM, the heaters are also controlled via software pwm. I don't know why, but this has caused some bed MOSFETs to bust in the past.
So whats the alternative?
I don't know. As @stklcode mentioned, activating the dithering might be the problem here. Also it could be helpful to increase the pwm frequency.
How was it handled prior to his Update to 2.1.1 ? Hardware PWM seems to have worked there on the fans as well, unless you had SOFT PWM enabled too in your latest build?
We used hardware PWM in previous versions (except 1.4.0). This conflicts with the speaker feature, as both speaker and fans share the same AVR timers. This has always been kind of a problem, but prior to Marlin 2.1 there simply was no sanity check which prevents the firmware from building now.
If there really is no suitable combination of soft PWM, frequency scaler and dithering, we can either not use the speaker or comment out the sanity check and tolerate the "problem".
Typically during print there aren't really many sounds to be played, so it should be acceptable that the speaker messes up with the fan PWM and vice versa. I believe it's only the fan, so fan speed is inaccurate during sound playback and sound is messed up when the fan speed changes at the same time. It's not pretty, but doesn't really affect the print job either.
I have the speaker completely off anyway, how would I go about re-enabling hardware PWM the way it was before? In my use case the speaker was annoying so Id be fine with it gone, can always just use octoprint to get audio feedback.
If have both
SPEAKER
andFAN_SOFT_PWM
unset, the project compiles with hardware PWM and without speaker.You'll run into an error during build.
986e416c7f/Marlin/src/HAL/AVR/inc/SanityCheck.h (L67-L73)
Introduced in https://github.com/MarlinFirmware/Marlin/pull/23672
Ignoring the build error (e.g commenting it out) should make it behave like prior though, no? Considering the speaker is always off for me.The thing is, I didn't have SOFT PWM on before and it still had the slow-pulse fan issue as you remember.So to get Pre-2.1 HardwarePWM FAN behavior, what do I have to do? Disable speaker and soft pwm?
and comment out the error handling?(Edit: Didn't notice the Conditional above errors only if speaker is on and soft off)
imo the MOSFET burning out is arguably the worse option, hence I'd rather have a buggy speaker or no speaker and I'm sure most others as well.
Exactly.
//#define FAN_SOFT_PWM
in Configuration.h//#define SPEAKER
in Configuration.h)First option will give you the pre-2.1 behavior, second will disable the speaker completely.
Perfect, for the public release maybe we should go with buggy speaker or offer 2 builds one with speaker and soft pwm and one without? Like I said I'd argue its better to not have the risk of blown mosfets.
Hi,
Sorry to disturb you.
i don't speak and understand very well English, sorry if the answer was already posted but i don't understand correctly everything, i hope you understand. viva google translate loll but not perfect
I have a mega pro with laser recently.
I wouldn't tell you anything by telling you that the stock firmware is more than badly made lol.
I've been looking for quite a while, without finding answers, for a way to compile the firmware with the built-in bitmap converter so as not to lose the laser .
Anyway, I came across your GitHub and I see that you have been working on the same issue.
My questions are:
have you managed to make a firmware that allows you to keep the laser function without any modification of the machine?
Did you manage to find how to integrate the bmp converter or did you do otherwise?
And finally, would you agree to explain to me how you did it or provide me with a functional marlin?
Best regards
I rebased my PR, reverted back to hardware PWM and disabled the sanity check with a corresponding comment. Just keep it "as is" for now and pospone optimization, if possible.
Another Info that might be useful is the official MEGA S Firmware, where SOFT_PWM is used, but no PID for Heaters. -> Click here.
Maybe I should get out my oscilloscope and take a good look at the PWM signals from the heaters to find out why MOSFETs have died in the past.
Personally have no skill with a oscilloscope, so go ahead 😅, I have a Mega S as well though if you need me to test something
Actually
PIDTEMP
and with the very last commit alsoPIDBEDTEMP
are enabled.I had no issues with scale 2, fan has less ticking at 25% with 3. Just one small print job so far, normal brhavior. Didn't measure anything yet, maybe some time next week (connectors arrived yesterday, so I have a comfortable breakout cable now)