aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* sched: Implement generic sleep mechanism based on tasks pendingKevin O'Connor2017-08-089-80/+60
| | | | | | | | | Track when tasks are pending and spin in irq_wait() when no tasks are pending. This improves the mechanism for sleeping the processor - it's simpler for the board specific code and it reduces the possibility of the processor sleeping when tasks are busy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Introduce sched_wake_tasks() function to wake up tasksKevin O'Connor2017-08-0810-10/+74
| | | | | | | | Add function to indicate when tasks need to be run. This will allow the scheduler code to know if there are any tasks that need to be processed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Tune the low-level timer entry and exit heuristicsKevin O'Connor2017-08-081-2/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Implement internal avr specific timer to handle 16bit overflowsKevin O'Connor2017-08-085-26/+31
| | | | | | | | | | Don't rely on the generic scheduler code to always have a timer no more than 1ms in the future. Instead, create an avr specific timer that will be called every 0x8000 ticks. This simplifies the generic code and it reduces the amount of code that needs to be run every millisecond. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Support adding timers to the start of timer_listKevin O'Connor2017-08-087-44/+61
| | | | | | | | If sched_add_timer() is called on a timer that would make it the new head of the list, then add it and signal the board code that the timer should be rescheduled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Don't count milliseconds in the periodic timerKevin O'Connor2017-08-084-37/+53
| | | | | | | It's not necessary to keep a millisecond counter. Replace the two users of sched_check_periodic() with explicit task wakeup flags. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sam3x8e: Fix watchdog timeout calculationKevin O'Connor2017-08-081-1/+1
| | | | | | | Fix error causing the watchdog to be set to an ~4ms timeout instead of 500ms. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Move prescaler and sleep initialization from timer.c to main.cKevin O'Connor2017-08-072-11/+21
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Enable watchdog code even on simulavrKevin O'Connor2017-08-071-1/+0
| | | | | | | | The simulavr simulator will warn when writing to the watchdog registers, but running code closer to what real hardware runs is worth a few extra warnings. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pwmcmds: Update event prototypes to use uint_fast8_tKevin O'Connor2017-08-061-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Improve comments in pru0.cKevin O'Connor2017-08-022-3/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Use a sane default for homing_positive_dirKevin O'Connor2017-07-249-42/+46
| | | | | | | Use the endstop position to determine a sane default for homing_positive_dir. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Separate out homing code to its own PrinterHomingStepper classKevin O'Connor2017-07-244-42/+45
| | | | | | | Keep the homing code separate from the main stepper class. This makes it easier to verify the correct config parameters are provided. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* config: Add additional pin definitions to ramps and rambo configsKevin O'Connor2017-07-242-2/+29
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* config: Change default pins defined in example.cfg to use RAMPS pinsKevin O'Connor2017-07-242-32/+27
| | | | | | | Change the example.cfg file to use the pins of a RAMPS config as that is a very common setup. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* config: Reduce max_z_velocity in example-delta.cfg to 150Kevin O'Connor2017-07-241-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Dump serial stats in dump_debug()Kevin O'Connor2017-07-241-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Don't wait for moves to finish if both debug input and outputKevin O'Connor2017-07-231-1/+2
| | | | | | Don't wait for moves to finish if the output is going to a debug file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Improve limit on number of in-flight bytesKevin O'Connor2017-07-231-6/+5
| | | | | | | | Instead of limiting the amount of non-acked messages to 50ms, limit the amount to one round-trip-time. This should make it less likely that the mcu will be overloaded and it should make retransmits faster. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Further retransmit timing fixesKevin O'Connor2017-07-231-5/+3
| | | | | | | | | The first message always has a sync byte with it, so its size should be one larger. Also, the idle_time should always be the minimum time that the message could be received, so it should always be reset to eventtime on a retransmit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Allow a second nak after a retransmitKevin O'Connor2017-07-211-3/+11
| | | | | | | | | If a nak message causes a retransmission then also accept a second nak message as long as it is for a sequence greater than the first nak. This should allow faster retransmits when there are multiple transmission errors in a small time period. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Fix off-by-one error in retransmit sequence number trackingKevin O'Connor2017-07-211-3/+3
| | | | | | | | Track the sequence number of the message last retransmitted (not the sequence number of the next message to be transmitted). This fixes a small possibility of a valid nak not being honored. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Improve timing of multiple retransmitsKevin O'Connor2017-07-211-8/+12
| | | | | | | | If a retransmit is triggered by a nak, then it is not necessary to increase the rto. The next retransmit time should be based on the expected reception of the first retransmitted message, not the last. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Improve end-of-file handling when input is a debug fileKevin O'Connor2017-07-211-7/+10
| | | | | | | | | Wait for any pending moves to be fully handled before exiting. Make sure the wait is done inside the "self.is_processing_data" check to avoid infinite recursion. Don't keep reading from the file while waiting to exit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* graphstats: Fix so that older files (predating mcu_awake) still workKevin O'Connor2017-07-211-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Allow boards to disable digital input/output supportKevin O'Connor2017-07-206-1/+17
| | | | | | | | Allow the micro-controller code to be built without support for regular gpio pins. In this case, the code for endstops, steppers, and gpiocmds will be disabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Move low-level alloc code into basecmd.cKevin O'Connor2017-07-206-90/+74
| | | | | | | | Implement new dynmem_start() and dynmem_end() functions instead of alloc_chunk() and alloc_chunks() in the board code. This simplifies the board code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* docs: Update Kinematics.md with regards to stepper torque limitsKevin O'Connor2017-07-191-10/+10
| | | | | | | It is not necessary to limit stepper acceleration - only the limiting of stepper torque is important. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* docs: Improve description of delta stepper acceleration limitsKevin O'Connor2017-07-192-14/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* graphstats: Support graphing "mcu_awake" statisticKevin O'Connor2017-07-191-2/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Support sleeping when mcu is idleKevin O'Connor2017-07-1713-10/+101
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Add support for heater_fan objectsKevin O'Connor2017-07-175-6/+63
| | | | | | | Add support for fans designed to cool the components of an extruder or heater. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Support converting from a system time to an mcu timeKevin O'Connor2017-07-171-0/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Log g-code error responsesKevin O'Connor2017-07-171-2/+3
| | | | | | Be sure to log g-code errors even if debug logging is not enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Move peripheral init from pru0 to pru1Kevin O'Connor2017-07-173-45/+37
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Move ADC code from gpio.c to new file adc.cKevin O'Connor2017-07-123-66/+78
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Fix readl() typo in serial.cKevin O'Connor2017-07-121-1/+1
| | | | | | The code should have used a readb() call instead of readl(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* config: Update PRU based configs to use the correct serial deviceKevin O'Connor2017-07-062-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add documentation and install scripts for running on the PRUKevin O'Connor2017-07-055-0/+333
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add support for "make flash" ruleKevin O'Connor2017-07-052-0/+34
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* fan: Support setting a max_power attribute for the print cooling fanKevin O'Connor2017-07-052-3/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Pass shutdown reason code via longjmp() parameterKevin O'Connor2017-07-042-7/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Catch exceptions during identify data parsingKevin O'Connor2017-07-041-12/+18
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* msgproto: Export static_strings from mcu to host as a dictionaryKevin O'Connor2017-07-022-4/+6
| | | | | | Export the static strings as a dictionary instead of as a list. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Rename clock estimation variable namesKevin O'Connor2017-06-303-16/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Rework mcu clock synchronizationKevin O'Connor2017-06-301-52/+68
| | | | | | | | | | | | | | | | | | | | | | The existing clock synchronization code has two flaws: intermittent transmission latency during get_status requests can cause the estimated clock to be too low, and the estimated clock calculation did not take into account possible clock drift between samples. The former could potentially lead to "Timer too close" errors and the latter could potentially lead to "Move queue empty" errors. Rework the code to avoid the above problems. It's not necessary to estimate the micro-controller clock as an excellent estimate is reported by the micro-controller (via the CLOCK_FREQ constant). Account for a small drift from the reported value, and check on each sample if the drift exceeds the expected limits. With a good starting estimated clock, only the offset needs to be calculated. Use previous offsets (and the estimated clock) in calculation of new offsets to avoid intermittent latency from badly skewing the results. Finally, add an additional time offset of one millisecond to account for any minor inaccuracies. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialqueue: Clarify code that associates sent messages to received messagesKevin O'Connor2017-06-301-6/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Use a pointer when working with send_data array itemsKevin O'Connor2017-06-303-17/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add hack to shutdown the PRU from a simple command requestKevin O'Connor2017-06-301-0/+6
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Rework command processing so that most of it is done on pru0Kevin O'Connor2017-06-306-93/+214
| | | | | | | | Change the command dispatch and response generation so that most of the work is done on pru0 instead of pru1. This allows more code to fit into the limited space on pru1. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>