ReflowMaster icon indicating copy to clipboard operation
ReflowMaster copied to clipboard

PlatformIO, Code cleanup, safety, and facilities for inverting the fan/SSR outputs

Open fake-name opened this issue 4 years ago • 6 comments

I put together a little hacked up board running this for reflow purposes.

It's quite nice, but there's a fair number of things I didn't like. This is basically my improvements:

  • [x] Build with PlatformIO (because the arduino editor + 2 macro buttons is terrible).
  • [x] Add facilities for inverted fan control/ssr outputs.
  • [ ] Expose inverted outputs in settings
  • [x] Fix all warnings on build.
  • [x] General code cleanup and formatting (mostly astyle)
  • [x] Use actual, proper enums for state, so there's not mystery numbers everywhere
  • [ ] Reformat reflow profiles so they don't need messy run-time definition (and can be extended a lot easier).
  • [ ] Handle open/broken thermocouple. Right now, you can still start the oven with no thermocouple connected, and it'll turn the heaters on full for at least a few seconds before noticing anything is wrong. I'm not sure if there's an error state that can make the returned voltage too low (a short outside the oven?), but that'd be worth checking for as well. Checking that the heater control signal effects the read-back temperature is a known and reliable safety measure in 3D printers, it'd possibly be worth considering here.
  • [ ] Reduce oven SSR PWM frequency. If your oven SSR is triac based, a high PWM frequency means you have almost no control of actual power at low duty cycles, as the triac latches for an entire 1/2 the AC waveform. That means that you can never reduce the power lower then ~5/6 of full power, since with a 748 hz PWM frequency, there are ~6.2 PWM pulses per AC half wave.
    Generally, there's no good reason to PWM at more then a few hertz, since the thermal mass of the oven will probably result in response bandwidth on the order of many seconds.
  • [ ] Collapse giant if-else statements into case statements (this is why C has case statements!).
  • [ ] Typos! (currentDetla? Probably more)
  • [ ] Maybe: Most ILI9341 screens have optional touch-screens (including the one I have). Maybe use that?
  • [ ] Maybe: Move all the state-machine globals into a single struct/class?
  • [ ] Maybe: Add facility for a door opener (often done with a simple R/C servo.
  • [ ] Maybe: Right now, when the millis() rolls over, things will probably break in some manner. This can be solved by treating time as a unsigned int and only ever computing relative time deltas, but switching the current system to that will require careful checking.

This is WIP, but I think most of it is valuable. Using PIO for building is particularly useful since it means multi-platform builds (such as https://github.com/UnexpectedMaker/ReflowMaster/pull/3) would be much easier.

fake-name avatar Sep 28 '20 08:09 fake-name

Oh hey, this is awesome! But it seems we've clashed :)

I have a v1.09 that already has a bunch of what you have listed implemented... not all though and no platform.io support.

My v1.09

  • moved all states to enums
  • thermocouple error tracking with on screen feedback and reflow blocking if no TC detected
  • some code cleanup (variable spelling, code formatting etc, better use variable types)

v1.09 is already going to customers on current Reflow Masters I am shipping

I also have a v1.10 in dev that has more changes and new features.

So I'm not going to be able to merge this PR - at least not until after my new changes are here.

Unfortunately I have no ETA on that right now as I am swamped with other work.

UnexpectedMaker avatar Sep 28 '20 10:09 UnexpectedMaker

That makes sense, though I can rebase off of whatever branch is preferred.

Is there a dev branch somewhere?

fake-name avatar Sep 28 '20 23:09 fake-name

That makes sense, though I can rebase off of whatever branch is preferred.

Is there a dev branch somewhere?

No dev branch on github, sorry. I usually only push to github when I'm happy with the release.

UnexpectedMaker avatar Sep 28 '20 23:09 UnexpectedMaker

That seems like the canonical purpose of having a dev or wip branch.

fake-name avatar Sep 29 '20 00:09 fake-name

Well, I don't release every code version to the public, so not really. I had a few people make competing products and ship them with my code, so I'm much more cautious now about if and when I make updates public these days.

UnexpectedMaker avatar Sep 29 '20 00:09 UnexpectedMaker

That kind of seems like it's not open source at that point.

Anyways, is there any chance you could plonk stuff up somewhere so I don't wind up duplicating work that's already been done? I'm at the point where I'm trying to get my DIY oven going, and have time to spend on helping out/improving the code at the moment.

fake-name avatar Sep 29 '20 07:09 fake-name