Commit Graph

49 Commits

Author SHA1 Message Date
Scott Lahteine
eaa66f3c46 Indent MarlinSerial code 2017-04-02 01:05:25 -05:00
Scott Lahteine
cd882b88db #if defined => #ifdef / PIN_EXISTS 2017-03-22 20:51:11 -05:00
Scott Lahteine
50ee749082 Centralize click-handling in the LCD loop 2016-10-28 20:57:21 -05:00
Scott Lahteine
c5fa70809b Implement M0/M1 for EMERGENCY_PARSER 2016-09-13 03:33:00 -05:00
AnHardt
7e36b76af2 Repair MarlinSerial with TX-buffer
These '{' are important to avoid the redefinition of `unsigned char _sreg = SREG;`
at the same level.
Used in
```
#define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
```
2016-08-22 23:40:09 +02:00
Scott Lahteine
14395a1a96 Optimize, reduce size of MarlinSerial 2016-08-19 16:53:20 -05:00
Scott Lahteine
1a558ef486 Tweak MarlinSerial precursor 2016-08-11 12:47:06 -07:00
Scott Lahteine
b73203a0b7 Move some includes around to uncover missing deps 2016-08-02 19:37:46 -07:00
Scott Lahteine
83d341c394 Make Conditionals.h a catch-all for old configs 2016-07-30 04:25:30 -07:00
João Brázio
3ebad4e020 Moves all global enums to a central file 2016-07-19 14:31:09 +01:00
esenapaj
58177a1602 Suppress warnings 2016-07-12 08:22:24 +09:00
Scott Lahteine
51c9c3fe2c Indentation in MarlinSerial.cpp 2016-07-09 17:57:53 -07:00
AnHardt
4b44a23a36 Add TX-buffer for MarlinSerial
Similar to the current Arduino HardwareSerial
but with max. 256 byte buffer-size.

Deactivated by default.

The boards with AT90USB processor (USBCON) already use a TX-buffer.
2016-07-08 17:25:21 +02:00
Scott Lahteine
bd5a825b8b Wait for end of line before invoking action 2016-07-07 16:37:23 -07:00
Scott Lahteine
ea47803ae2 Simplify emergency parser (only parse initial command) 2016-07-07 16:37:22 -07:00
Scott Lahteine
834ad14c8d Add quickstop_stepper to update current position with stepper.quick_stop() 2016-07-07 16:37:22 -07:00
AnHardt
a129078927 Add an emergency-command parser to MarlinSerial (supporting M108)
Add an emergency-command parser to MarlinSerial's RX interrupt.

The parser tries to find and execute M108,M112,M410 before the commands disappear in the RX-buffer.

To avoid false positives for M117, comments and commands followed by filenames (M23, M28, M30, M32, M33) are filtered.

This enables Marlin to receive and react on the Emergency command at all times - regardless of whether the buffers are full or not. It remains to convince hosts to send the commands. To inform the hosts about the new feature a new entry in the M115-report was made. "`EMERGENCY_CODES:M112,M108,M410;`".

The parser is fast. It only ever needs two switch decisions and one assignment of the new state for every character.

One problem remains. If the host has sent an incomplete line before sending an emergency command the emergency command could be omitted when the parser is in `state_IGNORE`.
In that case the host should send "\ncommand\n"

Also introduces M108 to break the waiting for the heaters in M109, M190 and M303.

Rename `cancel_heatup` to `wait_for_heatup` to better see the purpose.
2016-07-07 16:37:22 -07:00
Scott Lahteine
0da744b7b0 Further cleanup of comments, partial Doxygen-style
Following up on #3231
2016-03-25 00:45:56 -07:00
jbrazio
5e5d250832 Added gplv3 header to all Marlin files 2016-03-24 18:01:20 +00:00
Lukas Abfalterer
83795d3e63 deleted double used comments 2016-03-06 05:51:58 -08:00
Scott Lahteine
e4945b30d2 sbi and cbi are deprecated 2016-03-06 05:51:55 -08:00
Scott Lahteine
ff13070b59 Use _BV macros, patch up others 2016-03-06 05:51:55 -08:00
AnHardt
cb88fdd242 Protect MarlinSerial against interrupts
Protect MarlinSerial against interrupts
by shielding the CRITICAL_SECTIONs

Now with a test if RX_BUFFER_SIZE is in the required range.
Code in peek() and read() is now optimized for readability and showing the similarity between the two.

Maybe a bit overprotected in checkRx() and store_char(), but now some days without detected errors from this source.
2016-02-24 17:18:12 +01:00
AnHardt
dc0f41868e Make rx tail/head atomic 2016-02-24 15:51:34 +01:00
Scott Lahteine
9bdab4f3a8 Clean up "else" and other spacing 2015-11-12 00:03:21 -06:00
Scott Lahteine
0c7f7ebcfb Styling adjustments (PR#2668 & PR#2670)
Keep "astyled" reformatting
2015-10-03 22:02:45 -05:00
Richard Wackerbarth
4b9d5cd352 Use lowercase names for serial instances 2015-08-02 23:01:39 -05:00
Scott Lahteine
1e2deff4fd Rename BTENABLED to BLUETOOTH
- For some reason it’s easy to forget what BT stands for, but it
doesn’t need an abbreviation.
2015-08-02 22:56:50 -05:00
Scott Lahteine
58cfcd4239 Overridable Options - Part 5
Apply `ENABLED` / `DISABLED` macros to files needing only a small
number of changes.
2015-07-31 01:24:20 -05:00
Richard Wackerbarth
e83575537a Compiler defines USBCON for USB devices (PR#2433) 2015-07-15 10:32:11 -05:00
Scott Lahteine
c065da52ec Spacing and spelling 2015-04-03 22:54:48 -07:00
Scott Lahteine
1e5c18bb14 Add code_value_short and SERIAL_CHAR 2015-04-03 21:43:30 -07:00
Scott Lahteine
c37f7d15c9 - Rename WRITE_E_STEP for consistency
- Add BIT and TEST macros
- Add _APPLY_ macros to stepper.cpp to help with consolidation
- Consolidate code in stepper.cpp using macros
- Apply standards in stepper.cpp
- Use >= 0 instead of > -1 as a better semantic
- Replace DUAL_Y_CARRIAGE with Y_DUAL_STEPPER_DRIVERS
2015-03-14 04:28:22 -07:00
Scott Lahteine
fd78902194 Formatting cleanup of quiet sources 2015-01-23 21:11:50 -08:00
Scott Lahteine
f989bd5435 Simple code cleanup. Rename "homeing" to homing. 2014-10-05 13:20:53 -07:00
Cylindric
8f0cee2a14 Various typo fixes - only in comments, no code changes. 2014-02-17 10:58:36 +00:00
fmalpartida
b5a964fcc5 Initial SAV MkI (RepRap CloneWars board) integration.
Included support for BT dongle on AT90USB boards.
Added LCD Shift Register LCD control
Included support for RepRap Clone Wars project board (SAV MKI).
2013-10-30 11:45:32 +01:00
Johann Rocholl
6cba11f087 Stop redefining MOTHERBOARD and #define AT90USB instead. Also put #ifndef AT90USB around the HardwareSerial_h trick, so now Printrboard / Brainwave support compiles on Arduino 1.0.2 as well. 2012-12-09 01:32:09 -08:00
Robert F-C
ab9d183024 Make serial port configurable.
This change makes the choice of serial port configurable so that
wireless capability can be easily added by connecting Bluetooth modules
(such as BlueSmirf or JY-MCU) to the expansion port pins.
2012-11-05 21:34:27 +11:00
Erik van der Zalm
9173a5713b Teensylu support. 2012-02-09 19:27:45 +01:00
Bernhard
57f9359a41 simplified the includes, makefile now works with arduino23 2011-12-22 14:55:45 +01:00
Bernhard
7714b98da7 solved some compiler warnings that are now visible in arduino 1.0.
Found a couple of unused variables, that I commented.
Tried to solve the program memory warning message, and failed.
2011-12-04 12:40:18 +01:00
Bernhard
0bc9daa4f7 make it compile with arduino 1.0 ; function is still untested. 2011-12-01 16:38:01 +01:00
Bernhard
d00b7e5587 repaired compiliation in windows 2011-11-28 22:45:40 +01:00
Bernhard
b19c8b74b9 force inline 2011-11-28 21:51:44 +01:00
Bernhard
85da81e673 inlineing of small functions in serial 2011-11-28 19:34:42 +01:00
Bernhard
b9ad0bb2ce removed unecessary indirect register adressing in serial. 2011-11-28 19:28:38 +01:00
Bernhard
dd5ca68c87 get rid of indirect ringbuffer calls, made some inlines, removed virtual and streaming class requirements. 2011-11-28 19:13:40 +01:00
Erik van der Zalm
f75f426dfa Removed interrupt nesting in the stepper ISR.
Add serial checkRx in stepper ISR.
Copied HardwareSerial to MarlinSerial (Needed for checkRx).
2011-11-27 21:12:55 +01:00