Browse Source

Patch i2c, info menu

Scott Lahteine 5 years ago
parent
commit
035d6cd16d

+ 4
- 0
Marlin/src/HAL/HAL.h View File

27
 
27
 
28
 #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
28
 #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
29
 
29
 
30
+#ifndef I2C_ADDRESS
31
+  #define I2C_ADDRESS(A) (A)
32
+#endif
33
+
30
 inline void watchdog_refresh() {
34
 inline void watchdog_refresh() {
31
   TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
35
   TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
32
 }
36
 }

+ 3
- 0
Marlin/src/HAL/LPC1768/HAL.h View File

48
 #include <pinmapping.h>
48
 #include <pinmapping.h>
49
 #include <CDCSerial.h>
49
 #include <CDCSerial.h>
50
 
50
 
51
+// i2c uses 8-bit shifted address
52
+#define I2C_ADDRESS(A) ((A) << 1)
53
+
51
 //
54
 //
52
 // Default graphical display delays
55
 // Default graphical display delays
53
 //
56
 //

+ 1
- 1
Marlin/src/core/macros.h View File

292
 #define FMOD(x, y)  fmodf(x, y)
292
 #define FMOD(x, y)  fmodf(x, y)
293
 #define HYPOT(x,y)  SQRT(HYPOT2(x,y))
293
 #define HYPOT(x,y)  SQRT(HYPOT2(x,y))
294
 
294
 
295
-#define I2C_ADDRESS(A) int(TERN(TARGET_LPC1768, (A) << 1, A))
295
+#define I2C_ADDRESS(A) (typeof(A))(TERN(TARGET_LPC1768, (A) << 1, A))
296
 
296
 
297
 // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
297
 // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
298
 #define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
298
 #define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT

+ 2
- 9
Marlin/src/lcd/menu/menu_info.cpp View File

34
   #include "game/game.h"
34
   #include "game/game.h"
35
 #endif
35
 #endif
36
 
36
 
37
-#define VALUE_ITEM(MSG, VALUE, STYL)    do{ strcpy_P(buffer, PSTR(": ")); strcpy(buffer + 2, VALUE); STATIC_ITEM(MSG, STYL, buffer); }while(0)
37
+#define VALUE_ITEM(MSG, VALUE, STYL)    do{ char buffer[21]; strcpy_P(buffer, PSTR(": ")); strcpy(buffer + 2, VALUE); STATIC_ITEM(MSG, STYL, buffer); }while(0)
38
-#define VALUE_ITEM_P(MSG, PVALUE, STYL) do{ strcpy_P(buffer, PSTR(": ")); strcpy_P(buffer + 2, PSTR(PVALUE)); STATIC_ITEM(MSG, STYL, buffer); }while(0)
38
+#define VALUE_ITEM_P(MSG, PVALUE, STYL) do{ char buffer[21]; strcpy_P(buffer, PSTR(": ")); strcpy_P(buffer + 2, PSTR(PVALUE)); STATIC_ITEM(MSG, STYL, buffer); }while(0)
39
 
39
 
40
 #if ENABLED(PRINTCOUNTER)
40
 #if ENABLED(PRINTCOUNTER)
41
 
41
 
51
 
51
 
52
     printStatistics stats = print_job_timer.getStats();
52
     printStatistics stats = print_job_timer.getStats();
53
 
53
 
54
-    char buffer[21];
55
-
56
     START_SCREEN();                                                                         // 12345678901234567890
54
     START_SCREEN();                                                                         // 12345678901234567890
57
     VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT);            // Print Count: 999
55
     VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT);            // Print Count: 999
58
     VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT);    // Completed  : 666
56
     VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT);    // Completed  : 666
100
 void menu_info_thermistors() {
98
 void menu_info_thermistors() {
101
   if (ui.use_click()) return ui.go_back();
99
   if (ui.use_click()) return ui.go_back();
102
 
100
 
103
-  char buffer[21];  // For macro usage
104
-
105
   START_SCREEN();
101
   START_SCREEN();
106
 
102
 
107
   #if EXTRUDERS
103
   #if EXTRUDERS
208
 void menu_info_board() {
204
 void menu_info_board() {
209
   if (ui.use_click()) return ui.go_back();
205
   if (ui.use_click()) return ui.go_back();
210
 
206
 
211
-  char buffer[21];  // For macro usage
212
-
213
   START_SCREEN();
207
   START_SCREEN();
214
   STATIC_ITEM_P(PSTR(BOARD_INFO_NAME), SS_CENTER|SS_INVERT);       // MyPrinterController
208
   STATIC_ITEM_P(PSTR(BOARD_INFO_NAME), SS_CENTER|SS_INVERT);       // MyPrinterController
215
   #ifdef BOARD_WEBSITE_URL
209
   #ifdef BOARD_WEBSITE_URL
248
     STATIC_ITEM_P(PSTR(STRING_DISTRIBUTION_DATE));              // YYYY-MM-DD HH:MM
242
     STATIC_ITEM_P(PSTR(STRING_DISTRIBUTION_DATE));              // YYYY-MM-DD HH:MM
249
     STATIC_ITEM_P(PSTR(MACHINE_NAME));                          // My3DPrinter
243
     STATIC_ITEM_P(PSTR(MACHINE_NAME));                          // My3DPrinter
250
     STATIC_ITEM_P(PSTR(WEBSITE_URL));                           // www.my3dprinter.com
244
     STATIC_ITEM_P(PSTR(WEBSITE_URL));                           // www.my3dprinter.com
251
-    char buffer[21];
252
     VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2
245
     VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2
253
     #if ENABLED(AUTO_BED_LEVELING_3POINT)
246
     #if ENABLED(AUTO_BED_LEVELING_3POINT)
254
       STATIC_ITEM(MSG_3POINT_LEVELING);                         // 3-Point Leveling
247
       STATIC_ITEM(MSG_3POINT_LEVELING);                         // 3-Point Leveling

Loading…
Cancel
Save