Patch i2c, info menu

This commit is contained in:
Scott Lahteine 2020-04-27 09:42:51 -05:00
parent 9b90dfaa48
commit 035d6cd16d
4 changed files with 10 additions and 10 deletions

View file

@ -27,6 +27,10 @@
#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION) #define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
#ifndef I2C_ADDRESS
#define I2C_ADDRESS(A) (A)
#endif
inline void watchdog_refresh() { inline void watchdog_refresh() {
TERN_(USE_WATCHDOG, HAL_watchdog_refresh()); TERN_(USE_WATCHDOG, HAL_watchdog_refresh());
} }

View file

@ -48,6 +48,9 @@ extern "C" volatile uint32_t _millis;
#include <pinmapping.h> #include <pinmapping.h>
#include <CDCSerial.h> #include <CDCSerial.h>
// i2c uses 8-bit shifted address
#define I2C_ADDRESS(A) ((A) << 1)
// //
// Default graphical display delays // Default graphical display delays
// //

View file

@ -292,7 +292,7 @@
#define FMOD(x, y) fmodf(x, y) #define FMOD(x, y) fmodf(x, y)
#define HYPOT(x,y) SQRT(HYPOT2(x,y)) #define HYPOT(x,y) SQRT(HYPOT2(x,y))
#define I2C_ADDRESS(A) int(TERN(TARGET_LPC1768, (A) << 1, A)) #define I2C_ADDRESS(A) (typeof(A))(TERN(TARGET_LPC1768, (A) << 1, A))
// Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
#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 #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

View file

@ -34,8 +34,8 @@
#include "game/game.h" #include "game/game.h"
#endif #endif
#define VALUE_ITEM(MSG, VALUE, STYL) do{ strcpy_P(buffer, PSTR(": ")); strcpy(buffer + 2, VALUE); STATIC_ITEM(MSG, STYL, buffer); }while(0) #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)
#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) #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)
#if ENABLED(PRINTCOUNTER) #if ENABLED(PRINTCOUNTER)
@ -51,8 +51,6 @@
printStatistics stats = print_job_timer.getStats(); printStatistics stats = print_job_timer.getStats();
char buffer[21];
START_SCREEN(); // 12345678901234567890 START_SCREEN(); // 12345678901234567890
VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT); // Print Count: 999 VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT); // Print Count: 999
VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666 VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666
@ -100,8 +98,6 @@
void menu_info_thermistors() { void menu_info_thermistors() {
if (ui.use_click()) return ui.go_back(); if (ui.use_click()) return ui.go_back();
char buffer[21]; // For macro usage
START_SCREEN(); START_SCREEN();
#if EXTRUDERS #if EXTRUDERS
@ -208,8 +204,6 @@ void menu_info_thermistors() {
void menu_info_board() { void menu_info_board() {
if (ui.use_click()) return ui.go_back(); if (ui.use_click()) return ui.go_back();
char buffer[21]; // For macro usage
START_SCREEN(); START_SCREEN();
STATIC_ITEM_P(PSTR(BOARD_INFO_NAME), SS_CENTER|SS_INVERT); // MyPrinterController STATIC_ITEM_P(PSTR(BOARD_INFO_NAME), SS_CENTER|SS_INVERT); // MyPrinterController
#ifdef BOARD_WEBSITE_URL #ifdef BOARD_WEBSITE_URL
@ -248,7 +242,6 @@ void menu_info_board() {
STATIC_ITEM_P(PSTR(STRING_DISTRIBUTION_DATE)); // YYYY-MM-DD HH:MM STATIC_ITEM_P(PSTR(STRING_DISTRIBUTION_DATE)); // YYYY-MM-DD HH:MM
STATIC_ITEM_P(PSTR(MACHINE_NAME)); // My3DPrinter STATIC_ITEM_P(PSTR(MACHINE_NAME)); // My3DPrinter
STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com
char buffer[21];
VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2 VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2
#if ENABLED(AUTO_BED_LEVELING_3POINT) #if ENABLED(AUTO_BED_LEVELING_3POINT)
STATIC_ITEM(MSG_3POINT_LEVELING); // 3-Point Leveling STATIC_ITEM(MSG_3POINT_LEVELING); // 3-Point Leveling