From 75bfde994506504bbdcd42fb50a209d84ebe9be4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 8 Nov 2016 16:28:42 -0600 Subject: [PATCH 1/6] M155=>M260, M156=>M261 --- Marlin/Configuration_adv.h | 22 +-- Marlin/Marlin_main.cpp | 132 +++++++++--------- .../Cartesio/Configuration_adv.h | 22 +-- .../Felix/Configuration_adv.h | 22 +-- .../Hephestos/Configuration_adv.h | 22 +-- .../Hephestos_2/Configuration_adv.h | 22 +-- .../K8200/Configuration_adv.h | 22 +-- .../K8400/Configuration_adv.h | 22 +-- .../RigidBot/Configuration_adv.h | 22 +-- .../SCARA/Configuration_adv.h | 22 +-- .../TAZ4/Configuration_adv.h | 22 +-- .../WITBOX/Configuration_adv.h | 22 +-- .../delta/biv2.5/Configuration_adv.h | 22 +-- .../delta/generic/Configuration_adv.h | 22 +-- .../delta/kossel_mini/Configuration_adv.h | 22 +-- .../delta/kossel_pro/Configuration_adv.h | 22 +-- .../delta/kossel_xl/Configuration_adv.h | 22 +-- .../makibox/Configuration_adv.h | 22 +-- .../tvrrug/Round2/Configuration_adv.h | 22 +-- Marlin/twibus.h | 6 +- 20 files changed, 268 insertions(+), 266 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index abde757bd..01e78d720 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c05d0bd4a..68e84a055 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -214,6 +214,8 @@ * M226 - Wait until a pin is in a given state: "M226 P S" * M240 - Trigger a camera to take a photograph. (Requires CHDK or PHOTOGRAPH_PIN) * M250 - Set LCD contrast: "M250 C" (0-63). (Requires LCD support) + * M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS) + * M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS) * M280 - Set servo position absolute: "M280 P S". (Requires servos) * M300 - Play beep sound S P * M301 - Set PID parameters P I and D. (Requires PIDTEMP) @@ -5783,59 +5785,6 @@ inline void gcode_M121() { endstops.enable_globally(false); } #endif // BLINKM -#if ENABLED(EXPERIMENTAL_I2CBUS) - - /** - * M155: Send data to a I2C slave device - * - * This is a PoC, the formating and arguments for the GCODE will - * change to be more compatible, the current proposal is: - * - * M155 A ; Sets the I2C slave address the data will be sent to - * - * M155 B - * M155 B - * M155 B - * - * M155 S1 ; Send the buffered data and reset the buffer - * M155 R1 ; Reset the buffer without sending data - * - */ - inline void gcode_M155() { - // Set the target address - if (code_seen('A')) i2c.address(code_value_byte()); - - // Add a new byte to the buffer - if (code_seen('B')) i2c.addbyte(code_value_byte()); - - // Flush the buffer to the bus - if (code_seen('S')) i2c.send(); - - // Reset and rewind the buffer - else if (code_seen('R')) i2c.reset(); - } - - /** - * M156: Request X bytes from I2C slave device - * - * Usage: M156 A B - */ - inline void gcode_M156() { - if (code_seen('A')) i2c.address(code_value_byte()); - - uint8_t bytes = code_seen('B') ? code_value_byte() : 1; - - if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE) { - i2c.relay(bytes); - } - else { - SERIAL_ERROR_START; - SERIAL_ERRORLN("Bad i2c request"); - } - } - -#endif // EXPERIMENTAL_I2CBUS - /** * M200: Set filament diameter and set E axis units to cubic units * @@ -6182,6 +6131,59 @@ inline void gcode_M226() { } // code_seen('P') } +#if ENABLED(EXPERIMENTAL_I2CBUS) + + /** + * M260: Send data to a I2C slave device + * + * This is a PoC, the formating and arguments for the GCODE will + * change to be more compatible, the current proposal is: + * + * M260 A ; Sets the I2C slave address the data will be sent to + * + * M260 B + * M260 B + * M260 B + * + * M260 S1 ; Send the buffered data and reset the buffer + * M260 R1 ; Reset the buffer without sending data + * + */ + inline void gcode_M260() { + // Set the target address + if (code_seen('A')) i2c.address(code_value_byte()); + + // Add a new byte to the buffer + if (code_seen('B')) i2c.addbyte(code_value_byte()); + + // Flush the buffer to the bus + if (code_seen('S')) i2c.send(); + + // Reset and rewind the buffer + else if (code_seen('R')) i2c.reset(); + } + + /** + * M261: Request X bytes from I2C slave device + * + * Usage: M261 A B + */ + inline void gcode_M261() { + if (code_seen('A')) i2c.address(code_value_byte()); + + uint8_t bytes = code_seen('B') ? code_value_byte() : 1; + + if (i2c.addr && bytes && bytes <= TWIBUS_BUFFER_SIZE) { + i2c.relay(bytes); + } + else { + SERIAL_ERROR_START; + SERIAL_ERRORLN("Bad i2c request"); + } + } + +#endif // EXPERIMENTAL_I2CBUS + #if HAS_SERVOS /** @@ -7948,18 +7950,6 @@ void process_next_command() { #endif // BLINKM - #if ENABLED(EXPERIMENTAL_I2CBUS) - - case 155: // M155: Send data to an i2c slave - gcode_M155(); - break; - - case 156: // M156: Request data from an i2c slave - gcode_M156(); - break; - - #endif //EXPERIMENTAL_I2CBUS - #if ENABLED(MIXING_EXTRUDER) case 163: // M163: Set a component weight for mixing extruder gcode_M163(); @@ -8082,6 +8072,18 @@ void process_next_command() { break; #endif // HAS_LCD_CONTRAST + #if ENABLED(EXPERIMENTAL_I2CBUS) + + case 260: // M260: Send data to an i2c slave + gcode_M260(); + break; + + case 261: // M261: Request data from an i2c slave + gcode_M261(); + break; + + #endif // EXPERIMENTAL_I2CBUS + #if ENABLED(PREVENT_COLD_EXTRUSION) case 302: // M302: Allow cold extrudes (set the minimum extrude temperature) gcode_M302(); diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index c7aa0e89d..54e1353d8 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 0b76b4cb3..38f3c3b56 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 5f56e8403..be17e7462 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index 769e58dae..fbb975f5c 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 174bf821b..e8d949bf1 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -814,22 +814,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index 78661340f..d163cc69a 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 92c25ebcd..d16a69ec9 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 43ba636aa..c6f36a368 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 4e580a09c..113addaf5 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -816,22 +816,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 5f56e8403..be17e7462 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 7d952deed..6295b09f6 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -810,22 +810,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index c41d39fbc..ec36224ea 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -810,22 +810,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index c41d39fbc..ec36224ea 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -810,22 +810,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index ef8880254..beacff976 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -815,22 +815,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 763157193..d02650f58 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -810,22 +810,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 0e6059a57..6453b238f 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index ed951b31c..3b72bf06a 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -808,22 +808,22 @@ * * ; Example #1 * ; This macro send the string "Marlin" to the slave device with address 0x63 (99) - * ; It uses multiple M155 commands with one B arg - * M155 A99 ; Target slave address - * M155 B77 ; M - * M155 B97 ; a - * M155 B114 ; r - * M155 B108 ; l - * M155 B105 ; i - * M155 B110 ; n - * M155 S1 ; Send the current buffer + * ; It uses multiple M260 commands with one B arg + * M260 A99 ; Target slave address + * M260 B77 ; M + * M260 B97 ; a + * M260 B114 ; r + * M260 B108 ; l + * M260 B105 ; i + * M260 B110 ; n + * M260 S1 ; Send the current buffer * * ; Example #2 * ; Request 6 bytes from slave device with address 0x63 (99) - * M156 A99 B5 + * M261 A99 B5 * * ; Example #3 - * ; Example serial output of a M156 request + * ; Example serial output of a M261 request * echo:i2c-reply: from:99 bytes:5 data:hello */ diff --git a/Marlin/twibus.h b/Marlin/twibus.h index bd2d8a5d4..dd1cc1267 100644 --- a/Marlin/twibus.h +++ b/Marlin/twibus.h @@ -43,11 +43,11 @@ typedef void (*twiRequestFunc_t)(); * an experimental feature and it's inner workings as well as public facing * interface are prune to change in the future. * - * The two main consumers of this class are M155 and M156, where M155 allows + * The two main consumers of this class are M260 and M261, where M260 allows * Marlin to send a I2C packet to a device (please be aware that no repeated * starts are possible), this can be done in caching method by calling multiple - * times M155 B or a one liner M155, have a look at - * the gcode_M155() function for more information. M156 allows Marlin to + * times M260 B or a one liner M260, have a look at + * the gcode_M260() function for more information. M261 allows Marlin to * request data from a device, the received data is then relayed into the serial * line for host interpretation. * From 68b46fb2c96ac97776482f348e81ed53a586c477 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 8 Nov 2016 16:34:45 -0600 Subject: [PATCH 2/6] Allow send to i2c address 0 (broadcast) --- Marlin/twibus.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Marlin/twibus.cpp b/Marlin/twibus.cpp index 0352e1b9c..c5abdb2a9 100644 --- a/Marlin/twibus.cpp +++ b/Marlin/twibus.cpp @@ -77,8 +77,6 @@ void TWIBus::addstring(char str[]) { } void TWIBus::send() { - if (!this->addr) return; - #if ENABLED(DEBUG_TWIBUS) debug(PSTR("send"), this->addr); #endif From 68b866b5dd177e8b6ef93ccb2c57d91dc5c5cfea Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 8 Nov 2016 18:03:40 -0600 Subject: [PATCH 3/6] Add M155 - Auto-report temperature with interval --- Marlin/Configuration_adv.h | 5 +++ Marlin/Marlin_main.cpp | 38 +++++++++++++++++++ .../Cartesio/Configuration_adv.h | 5 +++ .../Felix/Configuration_adv.h | 5 +++ .../Hephestos/Configuration_adv.h | 5 +++ .../Hephestos_2/Configuration_adv.h | 5 +++ .../K8200/Configuration_adv.h | 5 +++ .../K8400/Configuration_adv.h | 5 +++ .../RigidBot/Configuration_adv.h | 5 +++ .../SCARA/Configuration_adv.h | 5 +++ .../TAZ4/Configuration_adv.h | 5 +++ .../WITBOX/Configuration_adv.h | 5 +++ .../delta/biv2.5/Configuration_adv.h | 5 +++ .../delta/generic/Configuration_adv.h | 5 +++ .../delta/kossel_mini/Configuration_adv.h | 5 +++ .../delta/kossel_pro/Configuration_adv.h | 5 +++ .../delta/kossel_xl/Configuration_adv.h | 5 +++ .../makibox/Configuration_adv.h | 5 +++ .../tvrrug/Round2/Configuration_adv.h | 5 +++ 19 files changed, 128 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 01e78d720..2be4fb46a 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 68e84a055..33cc43cbd 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -188,6 +188,7 @@ * M145 - Set heatup values for materials on the LCD. H B F for S (0=PLA, 1=ABS) * M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT) * M150 - Set BlinkM Color R U B. Values 0-255. (Requires BLINKM) + * M155 - Auto-report temperatures with interval of S. (Requires AUTO_REPORT_TEMPERATURES) * M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER) * M164 - Save the mix as a virtual extruder. (Requires MIXING_EXTRUDER and MIXING_VIRTUAL_TOOLS) * M165 - Set the proportions for a mixing extruder. Use parameters ABCDHI to set the mixing factors. (Requires MIXING_EXTRUDER) @@ -5135,6 +5136,31 @@ inline void gcode_M105() { SERIAL_EOL; } +#if ENABLED(AUTO_REPORT_TEMPERATURES) && (HAS_TEMP_HOTEND || HAS_TEMP_BED) + + static uint8_t auto_report_temp_interval; + static millis_t next_temp_report_ms; + + /** + * M155: Set temperature auto-report interval. M155 S + */ + inline void gcode_M155() { + if (code_seen('S')) { + auto_report_temp_interval = code_value_byte(); + NOMORE(auto_report_temp_interval, 60); + next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval; + } + } + + inline void auto_report_temperatures() { + if (auto_report_temp_interval && ELAPSED(millis(), next_temp_report_ms)) { + next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval; + print_heaterstates(); + } + } + +#endif // AUTO_REPORT_TEMPERATURES + #if FAN_COUNT > 0 /** @@ -7840,6 +7866,12 @@ void process_next_command() { KEEPALIVE_STATE(NOT_BUSY); return; // "ok" already printed + #if ENABLED(AUTO_REPORT_TEMPERATURES) && (HAS_TEMP_HOTEND || HAS_TEMP_BED) + case 155: // M155: Set temperature auto-report interval + gcode_M155(); + break; + #endif + case 109: // M109: Wait for hotend temperature to reach target gcode_M109(); break; @@ -9663,7 +9695,13 @@ void idle( #endif ) { lcd_update(); + host_keepalive(); + + #if ENABLED(AUTO_REPORT_TEMPERATURES) && (HAS_TEMP_HOTEND || HAS_TEMP_BED) + auto_report_temperatures(); + #endif + manage_inactivity( #if ENABLED(FILAMENT_CHANGE_FEATURE) no_stepper_sleep diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index 54e1353d8..f7e905a52 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 38f3c3b56..23f9ddfaa 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index be17e7462..5b800b49e 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index fbb975f5c..fb2eab135 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index e8d949bf1..01ddd1082 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -843,4 +843,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index d163cc69a..16b87d259 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index d16a69ec9..2a6a15c3e 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index c6f36a368..30e90f70b 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 113addaf5..68d67ce56 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -845,4 +845,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index be17e7462..5b800b49e 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 6295b09f6..172f6bda7 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -839,4 +839,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index ec36224ea..d32047493 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -839,4 +839,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index ec36224ea..d32047493 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -839,4 +839,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index beacff976..550269bfb 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -844,4 +844,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index d02650f58..7c61bfdc5 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -839,4 +839,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 6453b238f..986c09cff 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 3b72bf06a..07a097fcb 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -837,4 +837,9 @@ */ //#define PINS_DEBUGGING +/** + * Auto-report temperatures with M155 S + */ +//#define AUTO_REPORT_TEMPERATURES + #endif // CONFIGURATION_ADV_H From 3c9a838651861968109ea06b731d2a92905eb115 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 8 Nov 2016 18:05:59 -0600 Subject: [PATCH 4/6] Extended capabilities report in M115 --- Marlin/Conditionals_post.h | 6 -- Marlin/Configuration_adv.h | 5 ++ Marlin/Marlin_main.cpp | 68 ++++++++++++++++++- .../Cartesio/Configuration_adv.h | 5 ++ .../Felix/Configuration_adv.h | 5 ++ .../Hephestos/Configuration_adv.h | 5 ++ .../Hephestos_2/Configuration_adv.h | 5 ++ .../K8200/Configuration_adv.h | 5 ++ .../K8400/Configuration_adv.h | 5 ++ .../RigidBot/Configuration_adv.h | 5 ++ .../SCARA/Configuration_adv.h | 5 ++ .../TAZ4/Configuration_adv.h | 5 ++ .../WITBOX/Configuration_adv.h | 5 ++ .../delta/biv2.5/Configuration_adv.h | 5 ++ .../delta/generic/Configuration_adv.h | 5 ++ .../delta/kossel_mini/Configuration_adv.h | 5 ++ .../delta/kossel_pro/Configuration_adv.h | 5 ++ .../delta/kossel_xl/Configuration_adv.h | 5 ++ .../makibox/Configuration_adv.h | 5 ++ .../tvrrug/Round2/Configuration_adv.h | 5 ++ Marlin/language.h | 2 +- 21 files changed, 157 insertions(+), 9 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 5dc5abc48..ff997ce10 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -28,12 +28,6 @@ #ifndef CONDITIONALS_POST_H #define CONDITIONALS_POST_H - #if ENABLED(EMERGENCY_PARSER) - #define EMERGENCY_PARSER_CAPABILITIES " EMERGENCY_CODES:M108,M112,M410" - #else - #define EMERGENCY_PARSER_CAPABILITIES "" - #endif - /** * Axis lengths and center */ diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 2be4fb46a..6faa05ae4 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 33cc43cbd..eef793eee 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -175,7 +175,7 @@ * M112 - Emergency stop. * M113 - Get or set the timeout interval for Host Keepalive "busy" messages. (Requires HOST_KEEPALIVE_FEATURE) * M114 - Report current position. - * M115 - Report capabilities. + * M115 - Report capabilities. (Extended capabilities requires EXTENDED_CAPABILITIES_REPORT) * M117 - Display a message on the controller screen. (Requires an LCD) * M119 - Report endstops status. * M120 - Enable endstops detection. @@ -5771,7 +5771,71 @@ inline void gcode_M114() { report_current_position(); } * M115: Capabilities string */ inline void gcode_M115() { - SERIAL_PROTOCOLPGM(MSG_M115_REPORT); + SERIAL_PROTOCOLLNPGM(MSG_M115_REPORT); + + #if ENABLED(EXTENDED_CAPABILITIES_REPORT) + + // EEPROM (M500, M501) + SERIAL_PROTOCOLPGM("Cap:"); + #if ENABLED(EEPROM_SETTINGS) + SERIAL_PROTOCOLLNPGM("EEPROM:1"); + #else + SERIAL_PROTOCOLLNPGM("EEPROM:0"); + #endif + + // AUTOREPORT_TEMP (M155) + SERIAL_PROTOCOLPGM("Cap:"); + #if ENABLED(AUTO_REPORT_TEMPERATURES) + SERIAL_PROTOCOLLNPGM("AUTOREPORT_TEMP:1"); + #else + SERIAL_PROTOCOLLNPGM("AUTOREPORT_TEMP:0"); + #endif + + // PROGRESS (M530 S L, M531 , M532 X L) + SERIAL_PROTOCOLPGM("Cap:"); + SERIAL_PROTOCOLPGM("PROGRESS:0"); + + // AUTOLEVEL (G29) + SERIAL_PROTOCOLPGM("Cap:"); + #if HAS_ABL + SERIAL_PROTOCOLLNPGM("AUTOLEVEL:1"); + #else + SERIAL_PROTOCOLLNPGM("AUTOLEVEL:0"); + #endif + + // Z_PROBE (G30) + SERIAL_PROTOCOLPGM("Cap:"); + #if HAS_BED_PROBE + SERIAL_PROTOCOLLNPGM("Z_PROBE:1"); + #else + SERIAL_PROTOCOLLNPGM("Z_PROBE:0"); + #endif + + // SOFTWARE_POWER (G30) + SERIAL_PROTOCOLPGM("Cap:"); + #if HAS_POWER_SWITCH + SERIAL_PROTOCOLLNPGM("SOFTWARE_POWER:1"); + #else + SERIAL_PROTOCOLLNPGM("SOFTWARE_POWER:0"); + #endif + + // TOGGLE_LIGHTS (M355) + SERIAL_PROTOCOLPGM("Cap:"); + #if HAS_CASE_LIGHT + SERIAL_PROTOCOLLNPGM("TOGGLE_LIGHTS:1"); + #else + SERIAL_PROTOCOLLNPGM("TOGGLE_LIGHTS:0"); + #endif + + // EMERGENCY_PARSER (M108, M112, M410) + SERIAL_PROTOCOLPGM("Cap:"); + #if ENABLED(EMERGENCY_PARSER) + SERIAL_PROTOCOLLNPGM("EMERGENCY_PARSER:1"); + #else + SERIAL_PROTOCOLLNPGM("EMERGENCY_PARSER:0"); + #endif + + #endif // EXTENDED_CAPABILITIES_REPORT } /** diff --git a/Marlin/example_configurations/Cartesio/Configuration_adv.h b/Marlin/example_configurations/Cartesio/Configuration_adv.h index f7e905a52..9457e2cf0 100644 --- a/Marlin/example_configurations/Cartesio/Configuration_adv.h +++ b/Marlin/example_configurations/Cartesio/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 23f9ddfaa..4b6863eac 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index 5b800b49e..4a1f18a7d 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index fb2eab135..d56a4aba3 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index 01ddd1082..138826906 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -848,4 +848,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/K8400/Configuration_adv.h b/Marlin/example_configurations/K8400/Configuration_adv.h index 16b87d259..d601e039a 100644 --- a/Marlin/example_configurations/K8400/Configuration_adv.h +++ b/Marlin/example_configurations/K8400/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index 2a6a15c3e..49e85037f 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 30e90f70b..8147a0246 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index 68d67ce56..e9417311e 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -850,4 +850,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index 5b800b49e..4a1f18a7d 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 172f6bda7..a478e0197 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -844,4 +844,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index d32047493..08f36f5f7 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -844,4 +844,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index d32047493..08f36f5f7 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -844,4 +844,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index 550269bfb..894ce85ed 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -849,4 +849,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 7c61bfdc5..77c899597 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -844,4 +844,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 986c09cff..ca451cc3b 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 07a097fcb..22c0a04e7 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -842,4 +842,9 @@ */ //#define AUTO_REPORT_TEMPERATURES +/** + * Include capabilities in M115 output + */ +//#define EXTENDED_CAPABILITIES_REPORT + #endif // CONFIGURATION_ADV_H diff --git a/Marlin/language.h b/Marlin/language.h index 87a0d08c3..4254f4493 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -129,7 +129,7 @@ #define MSG_INVALID_EXTRUDER "Invalid extruder" #define MSG_INVALID_SOLENOID "Invalid solenoid" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature" -#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID EMERGENCY_PARSER_CAPABILITIES "\n" +#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID #define MSG_COUNT_X " Count X: " #define MSG_COUNT_A " Count A: " #define MSG_ERR_KILLED "Printer halted. kill() called!" From c8d4cd35d81a1b9ec8cedeacfebda5900d740e3c Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 8 Nov 2016 18:13:50 -0600 Subject: [PATCH 5/6] Include more features in Travis testing --- .travis.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5638542e7..85cee2199 100644 --- a/.travis.yml +++ b/.travis.yml @@ -106,7 +106,7 @@ script: - opt_enable FIX_MOUNTED_PROBE Z_SAFE_HOMING - build_marlin # - # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, & DEBUG_LEVELING_FEATURE + # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, and DEBUG_LEVELING_FEATURE # - opt_enable AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE - opt_set ABL_GRID_POINTS_X 16 @@ -119,9 +119,9 @@ script: - opt_enable Z_PROBE_SLED - build_marlin # - # ...with AUTO_BED_LEVELING_LINEAR & DEBUG_LEVELING_FEATURE + # ...with AUTO_BED_LEVELING_LINEAR, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, and EEPROM_CHITCHAT # - - opt_enable AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE + - opt_enable AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT - build_marlin # # Test a Servo Probe @@ -130,9 +130,10 @@ script: - opt_enable NUM_SERVOS Z_ENDSTOP_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE - build_marlin # - # ...with AUTO_BED_LEVELING_3POINT & DEBUG_LEVELING_FEATURE + # ...with AUTO_BED_LEVELING_3POINT, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, EEPROM_CHITCHAT, EXTENDED_CAPABILITIES_REPORT, and AUTO_REPORT_TEMPERATURES # - - opt_enable AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE + - opt_enable AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT + - opt_enable_adv EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES - build_marlin # # Test MESH_BED_LEVELING feature, with LCD From b31a07e261b385f3ae27981d377f719884991871 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 9 Nov 2016 03:07:24 -0600 Subject: [PATCH 6/6] Stateful M355 with separate P parameter --- Marlin/Marlin_main.cpp | 58 +++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index eef793eee..a88d2481a 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -868,11 +868,20 @@ void setup_homepin(void) { #if HAS_CASE_LIGHT void setup_case_light() { - #if ENABLED(CASE_LIGHT_DEFAULT_ON) - OUT_WRITE(CASE_LIGHT_PIN, HIGH); - #else - OUT_WRITE(CASE_LIGHT_PIN, LOW); - #endif + digitalWrite(CASE_LIGHT_PIN, + #if ENABLED(CASE_LIGHT_DEFAULT_ON) + 255 + #else + 0 + #endif + ); + analogWrite(CASE_LIGHT_PIN, + #if ENABLED(CASE_LIGHT_DEFAULT_ON) + 255 + #else + 0 + #endif + ); } #endif @@ -7183,33 +7192,30 @@ inline void gcode_M907() { #endif // HAS_MICROSTEPS #if HAS_CASE_LIGHT + /** - * M355: Turn case lights on/off - * - * S change state on/off or sets PWM + * M355: Turn case lights on/off and set brightness * + * S Turn case light on or off + * P Set case light brightness (PWM pin required) */ inline void gcode_M355() { + static bool case_light_on + #if ENABLED(CASE_LIGHT_DEFAULT_ON) + = true + #else + ; + #endif + static uint8_t case_light_brightness = 255; + if (code_seen('P')) case_light_brightness = code_value_byte(); if (code_seen('S')) { - SERIAL_ECHO_START; - SERIAL_ECHOPGM("Case lights "); - byte light_pwm = code_value_byte(); - switch (light_pwm) { - case 0: // Disable lights - SERIAL_ECHOPGM("off"); - break; - case 1: // Enable lights - light_pwm = 255; - SERIAL_ECHOPGM("on"); - break; - default: // Enable lights PWM - SERIAL_ECHOPAIR("set to: ", (int)map(light_pwm, 0, 255, 0, 100)); - SERIAL_CHAR('%'); - break; - } - analogWrite(CASE_LIGHT_PIN, light_pwm); - SERIAL_EOL; + case_light_on = code_value_bool(); + digitalWrite(CASE_LIGHT_PIN, case_light_on ? HIGH : LOW); + analogWrite(CASE_LIGHT_PIN, case_light_on ? case_light_brightness : 0); } + SERIAL_ECHO_START; + SERIAL_ECHOPGM("Case lights "); + case_light_on ? SERIAL_ECHOLNPGM("on") : SERIAL_ECHOLNPGM("off"); } #endif // HAS_CASE_LIGHT