Selaa lähdekoodia

eeprom: provide smaller code for SERIAL_ECHOPAIR

SERIAL_ECHOPAIR implies, eventually, two calls to MYSERIAL.print.  One
of these has FORCE_INLINE for a per-character loop, and both involve
constructing a method call rather than a simple function call.

Produce better and smaller code by providing three specialised
functions serial_echopair.  This saves 672 bytes of program memory
(with EEPROM_SETTINGS and SDSUPPORT enabled).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Ian Jackson 12 vuotta sitten
vanhempi
commit
7bb326d389
2 muutettua tiedostoa jossa 12 lisäystä ja 1 poistoa
  1. 5
    1
      Marlin/Marlin.h
  2. 7
    0
      Marlin/Marlin.pde

+ 5
- 1
Marlin/Marlin.h Näytä tiedosto

@@ -84,7 +84,11 @@ const char echomagic[] PROGMEM ="echo:";
84 84
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
85 85
 #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
86 86
 
87
-#define SERIAL_ECHOPAIR(name,value) {SERIAL_ECHOPGM(name);SERIAL_ECHO(value);}
87
+#define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
88
+
89
+void serial_echopair_P(const char *s_P, float v);
90
+void serial_echopair_P(const char *s_P, double v);
91
+void serial_echopair_P(const char *s_P, unsigned long v);
88 92
 
89 93
 
90 94
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.

+ 7
- 0
Marlin/Marlin.pde Näytä tiedosto

@@ -203,6 +203,13 @@ bool Stopped=false;
203 203
 
204 204
 void get_arc_coordinates();
205 205
 
206
+void serial_echopair_P(const char *s_P, float v)
207
+    { serialprintPGM(s_P); SERIAL_ECHO(v); }
208
+void serial_echopair_P(const char *s_P, double v)
209
+    { serialprintPGM(s_P); SERIAL_ECHO(v); }
210
+void serial_echopair_P(const char *s_P, unsigned long v)
211
+    { serialprintPGM(s_P); SERIAL_ECHO(v); }
212
+
206 213
 extern "C"{
207 214
   extern unsigned int __bss_end;
208 215
   extern unsigned int __heap_start;

Loading…
Peruuta
Tallenna