瀏覽代碼

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 13 年之前
父節點
當前提交
7bb326d389
共有 2 個檔案被更改,包括 12 行新增1 行删除
  1. 5
    1
      Marlin/Marlin.h
  2. 7
    0
      Marlin/Marlin.pde

+ 5
- 1
Marlin/Marlin.h 查看文件

84
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
84
 #define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
85
 #define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
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
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
94
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.

+ 7
- 0
Marlin/Marlin.pde 查看文件

203
 
203
 
204
 void get_arc_coordinates();
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
 extern "C"{
213
 extern "C"{
207
   extern unsigned int __bss_end;
214
   extern unsigned int __bss_end;
208
   extern unsigned int __heap_start;
215
   extern unsigned int __heap_start;

Loading…
取消
儲存