Browse Source

Cosmetic fix for HAL_AVR/MarlinSerial.cpp

Instead of using const char, it is better to use uint8_t
etagle 7 years ago
parent
commit
c9bbef6380
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp

+ 6
- 2
Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp View File

84
     // Currently looking for: M108, M112, M410
84
     // Currently looking for: M108, M112, M410
85
     // If you alter the parser please don't forget to update the capabilities in Conditionals_post.h
85
     // If you alter the parser please don't forget to update the capabilities in Conditionals_post.h
86
 
86
 
87
-    FORCE_INLINE void emergency_parser(const unsigned char c) {
87
+    FORCE_INLINE void emergency_parser(const uint8_t c) {
88
 
88
 
89
       static e_parser_state state = state_RESET;
89
       static e_parser_state state = state_RESET;
90
 
90
 
169
   #endif // EMERGENCY_PARSER
169
   #endif // EMERGENCY_PARSER
170
 
170
 
171
   FORCE_INLINE void store_rxd_char() {
171
   FORCE_INLINE void store_rxd_char() {
172
+
172
     const ring_buffer_pos_t h = rx_buffer.head,
173
     const ring_buffer_pos_t h = rx_buffer.head,
173
                             i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1);
174
                             i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1);
174
 
175
 
176
+    // Read the character
177
+    const uint8_t c = M_UDRx;
178
+
175
     // If the character is to be stored at the index just before the tail
179
     // If the character is to be stored at the index just before the tail
176
     // (such that the head would advance to the current tail), the buffer is
180
     // (such that the head would advance to the current tail), the buffer is
177
     // critical, so don't write the character or advance the head.
181
     // critical, so don't write the character or advance the head.
178
-    const char c = M_UDRx;
179
     if (i != rx_buffer.tail) {
182
     if (i != rx_buffer.tail) {
180
       rx_buffer.buffer[h] = c;
183
       rx_buffer.buffer[h] = c;
181
       rx_buffer.head = i;
184
       rx_buffer.head = i;
194
     #endif
197
     #endif
195
 
198
 
196
     #if ENABLED(SERIAL_XON_XOFF)
199
     #if ENABLED(SERIAL_XON_XOFF)
200
+
197
       // for high speed transfers, we can use XON/XOFF protocol to do
201
       // for high speed transfers, we can use XON/XOFF protocol to do
198
       // software handshake and avoid overruns.
202
       // software handshake and avoid overruns.
199
       if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) {
203
       if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) {

Loading…
Cancel
Save