Re: Project: Teacup Firmware August 11, 2012 07:00AM |
Registered: 14 years ago Posts: 7,616 |
Quote
The only issue is if the interrupt latency is so long (or the delta so short) that the new trigger time has already passed when the interrupt installs the new time- if that happens then the timer must overflow before it triggers.
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware August 17, 2012 02:53PM |
Registered: 14 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware August 17, 2012 02:57PM |
Registered: 12 years ago Posts: 9 |
Re: Project: Teacup Firmware August 17, 2012 07:32PM |
Registered: 17 years ago Posts: 1,094 |
Re: Project: Teacup Firmware August 18, 2012 05:33AM |
Registered: 14 years ago Posts: 7,616 |
Quote
I'm rewriting dda for now, code is very tight and weird in some places.
Quote
Moving very slowly unfortunatly.
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware August 18, 2012 06:19AM |
Registered: 12 years ago Posts: 9 |
Re: Project: Teacup Firmware August 21, 2012 02:13PM |
Registered: 13 years ago Posts: 44 |
Quote
Another bad news is that code so depend on each other that one change immediatly propogate a whole bunch of required changes in other places. Which i think is very bad for any kind of project.
Re: Project: Teacup Firmware August 24, 2012 12:37PM |
Registered: 12 years ago Posts: 9 |
Re: Project: Teacup Firmware August 25, 2012 09:49AM |
Registered: 14 years ago Posts: 7,616 |
Quote
What it broken is steppers, dda, and a lot of other code
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware August 26, 2012 01:28AM |
Registered: 12 years ago Posts: 9 |
Re: Project: Teacup Firmware August 31, 2012 05:37AM |
Registered: 14 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware August 31, 2012 05:56PM |
Registered: 14 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware September 26, 2012 02:56PM |
Registered: 13 years ago Posts: 258 |
... if (((heaters_pid.p_factor == 0) && (heaters_pid.i_factor == 0) && (heaters_pid.d_factor == 0) && (heaters_pid.i_limit == 0)) || (crc_block(&heaters_pid.p_factor, 14) != eeprom_read_word((uint16_t *) &EE_factors.crc))) { heaters_pid.p_factor = DEFAULT_P; heaters_pid.i_factor = DEFAULT_I; heaters_pid.d_factor = DEFAULT_D; heaters_pid.i_limit = DEFAULT_I_LIMIT; } ...
Re: Project: Teacup Firmware September 28, 2012 06:16AM |
Registered: 14 years ago Posts: 7,616 |
Quote
Also, the teensy loader seems to clear out the EEPROM, so heater.c/heater_init() reads {P,I,D,Ilim} as {0,0,0,0} with a crc of 0 that appears valid to Teacup. Maybe it would be nice to OR the two PID parameter conditions together and set the parameters to default for the zero case:
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware September 28, 2012 08:58AM |
Registered: 14 years ago Posts: 7,616 |
Quote
Traumflug
(the one you gave doesn't show in which file, which line this snippet should be applied)
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware September 28, 2012 10:03AM |
Registered: 13 years ago Posts: 258 |
--- a/crc.c +++ b/crc.c @@ -29,7 +29,7 @@ uses avr-libc's optimised crc16 routine */ uint16_t crc_block(void *data, uint16_t len) { - uint16_t crc = 0; + uint16_t crc = 0xfeed; for (; len; data++, len--) { crc = _crc16_update(crc, *((uint8_t *) data)); }
Re: Project: Teacup Firmware September 29, 2012 05:25PM |
Registered: 14 years ago Posts: 7,616 |
Quote
I like 2 or 3
Quote
Maybe adding some salt to the CRC test would be a good fix?
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware September 29, 2012 05:37PM |
Registered: 14 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 01, 2012 11:16AM |
Registered: 13 years ago Posts: 258 |
diff --git a/config.teensy.h b/config.teensy.h index 7599cbd..b96cd1e 100644 --- a/config.teensy.h +++ b/config.teensy.h @@ -342,6 +342,14 @@ New plan: */ #define TEMP_RESIDENCY_TIME 60 +/** + TEMP_EWMA: Exponentially Weighted Moving Average alpha constant for smoothing noisy sensors. Undefine or set to + 1 for unfiltered data. Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of 0.05 to 0.1 + are typical. Smaller is smoother but slower, Larger is quicker but rougher. Good hardware shouldn't + be noisy. If you need to use this, set the PID parameter to zero (M132 S0) to make the PID loop + insensitive to noise. */ +//#define TEMP_EWMA 0.1 + /// which temperature sensors are you using? List every type of sensor you use here once, to enable the appropriate code. Intercom is the gen3-style separate extruder board. // #define TEMP_MAX6675 #define TEMP_THERMISTOR diff --git a/temp.c b/temp.c index 8247a07..79a1ded 100644 --- a/temp.c +++ b/temp.c @@ -289,7 +289,15 @@ void temp_sensor_tick() { default: /* prevent compiler warning */ break; } - temp_sensors_runtime.last_read_temp = temp; + #ifndef TEMP_EWMA + temp_sensors_runtime.last_read_temp = temp; + #else /* Exponentially smooth the temperature readings */ + #define EWMA_SCALE 1024L + #define EWMA_ALPHA ((long) (TEMP_EWMA * EWMA_SCALE)) + temp_sensors_runtime.last_read_temp = (EWMA_ALPHA * temp + + (EWMA_SCALE-EWMA_ALPHA) * temp_sensors_runtime.last_read_temp + ) / EWMA_SCALE; + #endif /* TEMP_EWMA */ } if (labs((int16_t)(temp_sensors_runtime.last_read_temp - temp_sensors_runtime.target_temp)) < (TEMP_HYSTERESIS*4)) { if (temp_sensors_runtime.temp_residency < (TEMP_RESIDENCY_TIME*120))
Re: Project: Teacup Firmware October 02, 2012 03:41PM |
Registered: 13 years ago Posts: 44 |
Re: Project: Teacup Firmware October 02, 2012 04:13PM |
Registered: 13 years ago Posts: 258 |
Quote
config.h
temperature is "achieved" for purposes of M109 and friends when actual temperature is within [hysteresis] of target for [residency] second
Re: Project: Teacup Firmware October 03, 2012 06:58AM |
Registered: 14 years ago Posts: 7,616 |
Quote
phord
I always assumed M116 was broken
Quote
phord
Should I expect M109 to work, too?
Quote
DaveX
Here's a patch that smooths temperature with an Exponentially Weighted Moving Average filter in temp.c:
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 03, 2012 10:57AM |
Registered: 13 years ago Posts: 258 |
Re: Project: Teacup Firmware October 04, 2012 06:28AM |
Registered: 14 years ago Posts: 7,616 |
Quote
Additionally, I think [github.com] might be needed for config_teensy.h and arduino_32U4.h to make the AIO*_ADC definitions consistent with the other chips
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 04, 2012 11:29AM |
Registered: 13 years ago Posts: 258 |
Re: Project: Teacup Firmware October 05, 2012 06:36AM |
Registered: 14 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 05, 2012 11:36AM |
Registered: 13 years ago Posts: 258 |
Re: Project: Teacup Firmware October 06, 2012 06:40AM |
Registered: 14 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: Project: Teacup Firmware October 07, 2012 12:46AM |
Registered: 13 years ago Posts: 258 |
for (i = 0; i < NUM_HEATERS; i++) { if (heaters.heater_pwm) { *heaters.heater_pwm = 0;
#define BANG_BANG_OFF 4to make it work.
#ifdef BANG_BANG for (i = 0; i < NUM_HEATERS; i++) { heaters.heater_pwm) = 0; } #endif
diff --git a/heater.c b/heater.c index 62d5981..b5bb83c 100644 --- a/heater.c +++ b/heater.c @@ -28,7 +28,11 @@ typedef struct { #undef DEFINE_HEATER /// \brief helper macro to fill heater definition struct from config.h // #define DEFINE_HEATER(name, port, pin, pwm) { &(port), (pin), &(pwm) }, +#ifndef BANG_BANG #define DEFINE_HEATER(name, pin) { &(pin ## _WPORT), pin ## _PIN, (pin ## _PWM) }, +#else // BANG_BANG will ignore any possible PWM pins +#define DEFINE_HEATER(name, pin) { &(pin ## _WPORT), pin ## _PIN, NULL }, +#endif static const heater_definition_t heaters[NUM_HEATERS] = { #include "config.h"
Re: Project: Teacup Firmware October 07, 2012 02:54AM |
Registered: 17 years ago Posts: 1,094 |