Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to merge talesin with DS18S20 support #1

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

aakatz3
Copy link
Member

@aakatz3 aakatz3 commented Jun 29, 2022

No description provided.

.. this should help to configure non-auto-detectable features.

Signed-off-by: Helmut Raiger <[email protected]>
  for heater and fan. They are non-inverted now,
i.e. on if high. Change pin setup and reverse PWM.

Signed-off-by: Helmut Raiger <[email protected]>
 ... this is in preparation for the secondary heater patch.
If this is selected the 1-wire pin is moved from P0.7 to P0.5
to allow access to PMW2 (P0.7).

NOTE: the display code simply writes to P1 pins, this would disturb
  the 1-wire communication if one of the P1 pins would have been
  used. Safer to stay on port 0!
  .. currently this is simply driven with the same values as
the original heater, this needs further investigation.
 ... just give it a standard baudrate and it'll work.
This is mainly to support communication issues with 115200.
As additional goody the serial interface now reports what it did
not understand.
  shell integration. Currently the serial command interpreter is
disabled.
  ... GUI should be just the same, but more wrapped up.
  only one left which is shared between Edit_Profile_Mode and
Select_Profile_Mode().
 currently this is more or less like the printfs before, but the level
may be changed at runtime and new formats may be implemented.
Currently only the level is prepended.
 but a few things were sacrificed for simplicity.
The bake timer is now not settable to infinity anymore.
If no coldjunction sensor is installed it simply vanishes instead
of stating 'not present'.
Bake mode controls don't vanish on value limits, but in setup
this won't either.
   https://github.com/matthiasb85/SimpleCLI
Needs commands and better texts.
Shows internal commands as internal and external?
 - implement non-mode-switching commands
 - improve user experience (prompt, version ...)
 - prepare main for mode switching

Fix a bug in Makefile (used a wrong path for SimpleCLI includes).
  set log_lvl 7 ... for verbose
  set reflow_log_lvl 7 ... for standby logging
  set reflow_log_lvl 0 ... for logging during bake and reflow
  ... implement reflow and bake. This is still a bit
clumsy, it switches the display mode to keep the serial interface
consistent with the GUI.
The 'setting x y' was not implemented on purpose for now. Actually
these values should not be set remotely (and most probably only
once during first set-up).
 - completely change the EEPROM format, holds 4 custom profiles now
    change temperature encoding to byte (20 .. 275 deg C allowed).
 - allow a profile to be saved from the shell:
    like: save NEW_PROFILE 30,40,50,60,...
 - custom profiles may have names now (only from the shell)
 - they may still be edited via the keyboard

Some things are gone, like non-volatile bake setpoint.
  adc.c used a buffer of 2 x 256 x 2 byte = 1024 bytes to
calculate the sum over the last 256 values for oversampling.
This is pretty useless in the first place as accuracy below 1K
are not to be expected even with a precision opamp instead of the
TLC27L2. The current implementation at least gets rid of the
buffer completely by using a running average method.
Along with the change the sampling is reduced to once per ms
instead of ever 100us, which was an overkill, new values
are delivered every 256ms now, which is good enough.

USE_PRECISION_OPAMP switches the internal gain to 0.36845 as the
pre-amplifier is supposed to have a gain of 222.2 (see adc.c).
At 300 degree C it uses 834 LSBs instead of only 307.

Using an OPA2333 or similiar and replacing the trim resistors
by fixed (and accurate) resistors will do the trick.
 .. there is still a bug when baking, this needs more than a
few lines of code.
 - simplify interface
 - make it an independent state machine (no external state switching).
 - move non-reflow stuff out to shell.c and main.c
 - get setpoint from profile using time (not index)
 - improve readability, lots of comments, lower complexity

Compiles, but does not work yet.
 - Reflow_GetSetpointAtTime()
 - add timing stuff

standby fan control not yet working, switch out of reflow screen ...
 - move plot profile to main.c, have profiles zero-terminated
 - make setpoint reporting independent of look-ahead drive
 ... to visualize bake mode better.

Still very buggy.
 .. don't use PID to cool down, go full speed and stop.
 .. fix last value interpolation in Reflow_GetSetpointAtTime()
 ... print and dump moved to shell.c.
Show current profile in 'profiles'
  This is to visualize the forced cooling cycle after any bake
or reflow (even if aborted). Only after cooling a new heating
cycle can be started, this also fixes a few strange behaviours
when started from the shell.
 ... this was removed during the change of the reflow state machine
and can now be done directly using Set_Fan().
 - lots of unsigned/signed comparision warnings, non of them critical
 - a few more unused argument warnings
 ... as space is not critical use -O2 instead, BUT this fails
completely! Won't start anymore, so the code is buggy at some
point not allowing for this kind of optimization.

So, onl make some of the time critical functions inlineable,
i.e. put them in the headers and make them static inline.

This is in preparation for the reduction of interrupt latencies
in onewire.c, which block interrupts for quite some time (as
identified and modified by radensb).
 .. block and unblock on byte boundaries instead of
whole sequences. This follows a patch by radensb.
 ... use the HW-FIFOs and ring buffer adequately.
 ... in preparation of composing a control temperature
which may be something else than a simple average.
  In standby mode the fan and heater were always turned off,
so that in setup mode the fan was turned on and off all the time.
Along with this fix the PWM control in io.c is simplified.
This is in preparation for the implementation of a new control strategy.
Auto-detection of sensors may be neat, but has it's drawbacks
if sensors disappear during operation. Currently this is not
fixed with the change either, but it will allow such a change
more easily.

This also improves the performance of Sensor_DoConversion() as
it will not check for the existance of sensors during the reflow process.
 This allows the user to select the 'weight' of the PCB to be
soldered. The value 0-100% goes from:

'super light weight': nearly no components, thin PCB material
  next to no reflective zones on it (it picks up lots of radiated
  heat).
'heavy weight': larger and heavier components (increased thermal
 capacity or lots of reflective zones (less radiation pickup).

... and everything in between.

Note: this requires the termal couples to be patched, see wiki.
 - left TC is light, right TC is heavy
 - change weight to be integer from 0 .. 100
 - add weight argument to reflow command in the shell
When simulating the PCB temperature the radiation pattern seems
to overheat the PCB even with the lowest weight selected, if
the PCB is placed on stand-offs in the drawer.

But it works super stable having them placed on the drawer bottom
directly! This spreads the heat on the board aswell!
The drawback is the cooling is lagging a lot, even slower
than the heavy thermo couple (which is more exposed to the
air stream caused by the fan).

The solution so far:
- place the PCB directly on the drawer bottom
- with pretty normal PCBs select a weight of about 20%
- remove the cooling ramp from the profiles
  this makes the reflow state machine go to COOLING and fully
  ventilate the drawer.
- tweak the control temperature so that it reflects something
  more likely to be the real PCB temperature (mostly informational
  anyway).
- show the cooling phase on the display

The best solution definitely would be to directly measure the
PCB temperature, but ramp-up with the simulator is about +/-5K
on the setpoint (the PID control still not fixed). The cooling
process is very dependent on the position in the drawer, it's
a lot more air on the left side!
@aakatz3 aakatz3 force-pushed the master branch 2 times, most recently from 46cf997 to bfc9b40 Compare July 18, 2023 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants