aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* basecmd: Use oid_ prefix for the oid manipulation functionsKevin O'Connor2017-03-097-36/+36
| | | | | | | Consistently use an "oid_" prefix on the oid functions - this makes them similar to other functions with a common prefix. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Support inverted PWM pinsKevin O'Connor2017-03-091-4/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support FIRMWARE_RESTART commandKevin O'Connor2017-03-085-24/+70
| | | | | | | | Add initial support for micro-controller resets via the Arduino reset mechanism. Also, automatically attempt a firmware restart if the printer CRC does not match. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Make sure to close the serial port on disconnect()Kevin O'Connor2017-03-081-9/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Improve error messages on failure to config printerKevin O'Connor2017-03-081-2/+9
| | | | | | | Don't report a CRC mismatch if a shutdown or other failure occurs during config - instead report the appropriate details. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Detect timeout in SerialReader.send_with_response()Kevin O'Connor2017-03-081-2/+11
| | | | | | Raise an error if the response is never received. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Default to using software PWMKevin O'Connor2017-03-087-14/+15
| | | | | | | Not all hardware has PWM support and there is no compelling reason to use hardware PWM for fans. Change the default to use software PWM. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Generalize the "move queue" runtime storageKevin O'Connor2017-03-083-40/+84
| | | | | | | | | Detect the maximum size of each "move queue" item during the configuration phase instead of using the stepper move struct. This allows the stepper code to be contained entirely in stepper.c and it allows for future run time allocations from other types of objects. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sam3x8e: Fix typo in gpio_in_setup() shutdown messageKevin O'Connor2017-03-081-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* docs: Fix typo in description of fan pin.Kevin O'Connor2017-03-071-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Load the mcu's 64bit clock at start of connectionKevin O'Connor2017-03-032-9/+25
| | | | | | | | Store a full 64bit uptime in the mcu and query it at the start of each connection. This ensures the host's 64bit clock is always in synch with the mcu's clock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Support max_power setting for heatersKevin O'Connor2017-03-034-29/+40
| | | | | | | | Change the mcu PWM value from an integer (0-255) to a float (0. - 1.). Add support for limiting the maximum power (as measured over a sufficiently long duration) to a particular heater. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Pressure advance lookahead time should start after decelKevin O'Connor2017-03-031-0/+4
| | | | | | | The pressure advance lookahead time should start after any full deceleration moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Allow configuration of pressure advance lookahead timeKevin O'Connor2017-02-222-6/+22
| | | | | | | | | | | | Instead of defaulting the pressure advance lookahead time to be the same as the pressure_advance variable, allow it to be configured. Default the new config setting (pressure_advance_lookahead_time) to 10ms. Also, make the setting more accurate if a future move is accelerating in the middle of the lookahead window. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Simplify maximum stepper velocity and accel checksKevin O'Connor2017-02-211-15/+18
| | | | | | | | | Simplify the mechanism for limiting stepper speed (introduced in commit bdfdf7ef) - split the extreme end of the build envelope into two zones and use the same speeds for all moves that traverse any part of one of those zones. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Enforce min/max_temp in heater.set_temp()Kevin O'Connor2017-02-212-3/+16
| | | | | | | Raise an error if the user requests a temperate outside the configured min/max_temp range. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Fix error in lookahead logicKevin O'Connor2017-02-201-11/+11
| | | | | | | | | | | | | | Commit c24b7a7e reworked the way lookahead was done and it introduced a bug when a full acceleration move is immiedietly followed by a full deceleration move. In that situation, depending on when the lookahead queue was flushed, it was possible to call move.move() without calling move.set_junction(). This resulted in a "Move instance has no attribute 'accel_t'" internal error. Simplify and fix the logic for checking full accel moves followed by full decel moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Use position_endstop for position_maxKevin O'Connor2017-02-192-6/+4
| | | | | | | There's no reason for the user to specify position_max - it can be inferred on deltas from the endstop positions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* armcm_irq: Move ARM Cortex-M irq handling to new fileKevin O'Connor2017-02-197-59/+64
| | | | | | | | The irq handling in sam3x8e isn't specific to the sam3x8e proccessor - it's generic for all armcm type machines. So, move the definitions into a new file generic/armcm-irq.c Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sam3x8e/timer: Be careful of races in timer_set_next()Kevin O'Connor2017-02-141-4/+16
| | | | | | | | | | | | | | It's possible for sched_del_timer() to be called on a timer that fires just after sched_del_timer disables irqs but before the next timer is scheduled. In this case be sure to clear the irq pending status flag after scheduling the next timer so that a delayed irq doesn't cause the wrong timer to be run. For the same reason, make sure to check the irq pending status flag at the start of the timer irq. Also, as a safety check, make sure timer_set_next() isn't called from within the timer irq dispatch loop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Cap maximum stepper velocity and accelerationKevin O'Connor2017-02-132-3/+47
| | | | | | | | | Some XY moves at the extreme end of the build envelope could cause excessive axis stepper movement. Check for any moves that could possibly result in a stepper movement of more than 3 times the XY movement and cap the move's acceleration and speed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* delta: Rework boundary checksKevin O'Connor2017-02-131-10/+16
| | | | | | | | Calculate and store the maximum xy2 value for the given z level each time the head moves to a new z level. This simplifies the boundary check for common XY moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Log the type of cpu the host is running onKevin O'Connor2017-02-122-0/+16
| | | | | | | | Report in the log the host CPU type and count. This helps distinguish between different rpi versions when debugging the log from a problem report. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Attempt to shutdown heaters and fans prior to a RESTARTKevin O'Connor2017-02-121-5/+14
| | | | | | | | | If the user requests a restart and the machine appears to be otherwise functioning normally, then attempt to stop the heaters and fans prior to restarting the host. This prevents the firmware from going into a shutdown state when the heater is on and the host restarts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Rework lookahead flush to be more stable during high cpuKevin O'Connor2017-02-123-23/+51
| | | | | | | | | | | | | | | | | Change the lookahead queue so that it attempts to buffer at least buffer_time_high amount of moves when first starting a print. This helps ensure the buffer is normally always full. If the buffer falls below buffer_time_low then it is either due to the end of a print or because octoprint/klippy is unable to keep up. Change the code so that in this case the lookahead queue will attempt to gather buffer_time_high amount of moves before restarting movement. Update the default buffer_time_low to 1 second and buffer_time_high to 2 seconds. With the above changes a smaller buffer_time_high and a larger buffer_time_low are more practical. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Flush lookahead buffer by timeKevin O'Connor2017-02-121-7/+12
| | | | | | | | | Use a minimum time window as a heuristic for determining when to try to lazily flush the lookahead buffer. In the common case this will result in more moves processed for each flush and thus reduce the overall cost of the lookahead processing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Separate motor off timer from main flush timerKevin O'Connor2017-02-122-25/+39
| | | | | | | Move the motor off time checking to its own code. This simplifies the main flush handler. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Increase maximum stepper halt velocityKevin O'Connor2017-02-121-1/+3
| | | | | | | | | | | | | Do a better job of calculating the maximum halt velocity for the stepper motors. The maximum cornering velocity is related to both the maximum acceleration and the junction_deviation, so both should be in the formula. Tests show that "math.sqrt(8. * self.junction_deviation * self.max_accel)" very closely fits the maximum on cartesian robots. This fixes potential "no next step" shutdowns that could occur on some print moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Fix omission causing gcode dump to not functionKevin O'Connor2017-02-121-2/+4
| | | | | | Fix bug that broke the gcode command dump after a shutdown. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* reactor: Use the system monotonic clock instead of the normal system clockKevin O'Connor2017-02-0610-45/+58
| | | | | | | | | | | | | The normal system clock can have sudden jumps if the system clock is changed. Use the system monotonic clock to avoid these sudden changes in time. It appears the Raspbian OS (which is used by OctoPi) is setup to update the system clock upon network connectivity. This could cause sudden system clock changes which could lead to Klippy processing errors. Using the monotonic clock eliminates these issues. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Introduce "smoothed" acceleration during lookaheadKevin O'Connor2017-02-062-9/+47
| | | | | | | | | Update the lookahead code to track both normal toolhead acceleration as well as a pseudo acceleration to the point of deceleration. This reduces the top speed of small zig-zag moves and it reduces printer vibration during these moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Remove unneeded forward pass in MoveQueue.flush()Kevin O'Connor2017-02-061-10/+10
| | | | | | | Simplify the code now that the extruder lookahead is separate from the main lookahead code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Remove the do_calc_junction flagKevin O'Connor2017-02-061-23/+14
| | | | | | | | It is not necessary to track the do_calc_junction flag as it can just as easily be determined at the top of the calc_junction() method. This simplifies the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Do extruder lookahead based on time instead of corneringKevin O'Connor2017-02-062-40/+37
| | | | | | | | | When calculating the extruder lookahead, determine how far to lookahead by the amount of elapsed time each move takes. This makes the extruder lookahead code more flexible as it is no longer limited to the next immediate cornering moves. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Move extruder specific lookahead into extruder classKevin O'Connor2017-02-062-48/+93
| | | | | | | | Instead of calculating min/max_corner_v in the toolhead class, calculate it in the extruder class. This keeps the extruder specific code together. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Propagate errors back to python codeKevin O'Connor2017-02-063-80/+146
| | | | | | | Propagate error codes back to the python code and raise an exception on an error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Exit on an unhandled exception when reading from a fileKevin O'Connor2017-02-061-0/+3
| | | | | | | When testing via a gcode input file, it's easier to debug problems if the program exits upon the first exception. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* graphstats: Display host buffer stats in graphKevin O'Connor2017-02-021-2/+24
| | | | | | | Prune host buffer stats near the start and end of the print. Graph the remaining buffer stats. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* io.h: read/write[bwl] should use barrierKevin O'Connor2017-02-023-9/+13
| | | | | | | Add barrier() calls to low-level read/write io calls so that their callers don't need to. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Make sure max_corner_v2 is fully calculated on a lazy flushKevin O'Connor2017-01-161-3/+7
| | | | | | | | | | | | Make sure max_corner_v2 is fully calculated before proactively flushing moves from the lookahead queue. Without this, some moves would do unnecessary pressure advance during cornering. Also, handle the min/max_corner_v2 calculations correctly in the rare case where a move that does only acceleration is immediately followed by a move that does only deceleration. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Change variables to use suffix "_v2" instead of prefix "junction_"Kevin O'Connor2017-01-162-46/+42
| | | | | | | | The junction speeds are tracked in velocity squared - introduce the common suffix "_v2" to track that instead of using a prefix of "junction_". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Clear do_calc_junction if using non-default accelKevin O'Connor2017-01-141-6/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serial: Be careful with comparison of transmit_max to transmit_posKevin O'Connor2017-01-142-2/+2
| | | | | | | | There is a small possibility that a shutdown could occur between clearing transmit_max and clearing transmit_pos - so make sure to handle the case where transmit_pos > transmit_max. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Minor change - remove unneeded header filesKevin O'Connor2017-01-144-5/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: No need to disable irqs in sendf reentrant checkKevin O'Connor2017-01-143-14/+16
| | | | | | | | | As long as the code is careful when writing the in_sendf variable it should be safe to update it without having to disable irqs. Also, make sure in_sendf is cleared on shutdown. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Check for reentrant calls to sendf()Kevin O'Connor2017-01-132-4/+15
| | | | | | | | | Allow sendf() to be called from irq and timer context - check for the case where sendf() is called while already in sendf() and simply discard those messages. This makes it safe to use output() debugging calls even in irq and timer context. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Resend PWM values even if last value was zeroKevin O'Connor2017-01-121-3/+4
| | | | | | | | | Continue to resend the pwm value even if the last value was zero - this extends the debugging info. Also, add the target temperature to the pwm debugging. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Only create a soft PWM object for PID heatersKevin O'Connor2017-01-101-3/+9
| | | | | | | The "watermark" style heater only needs a digital_out pin - not a software PWM pin. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Change cornering_min/max variable name to junction_corner_min/maxKevin O'Connor2017-01-101-7/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* heater: Report last temperature in PWM debuggingKevin O'Connor2017-01-101-1/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>