Add Laser Based I2C Ammeter Feature (#21835)

This commit is contained in:
Mike La Spina
2021-06-07 14:15:09 -05:00
committed by Scott Lahteine
parent a3063a9392
commit 2fd9971f41
12 changed files with 314 additions and 34 deletions

View File

@ -50,6 +50,10 @@
#include "../../feature/cooler.h"
#endif
#if ENABLED(I2C_AMMETER)
#include "../../feature/ammeter.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../../feature/bedlevel/bedlevel.h"
#endif
@ -588,12 +592,26 @@ FORCE_INLINE void _draw_cooler_status(const char prefix, const bool blink) {
#if ENABLED(LASER_COOLANT_FLOW_METER)
FORCE_INLINE void _draw_flowmeter_status() {
lcd_put_u8str("~ ");
lcd_put_u8str("~");
lcd_put_u8str(ftostr11ns(cooler.flowrate));
lcd_put_wchar('L');
}
#endif
#if ENABLED(I2C_AMMETER)
FORCE_INLINE void _draw_ammeter_status() {
lcd_put_u8str(" ");
ammeter.read();
if (ammeter.current <= .999) {
lcd_put_u8str(ftostr3ns(ammeter.current));
lcd_put_u8str("mA");
} else {
lcd_put_u8str(ftostr12ns(ammeter.current));
lcd_put_wchar('A');
}
}
#endif
FORCE_INLINE void _draw_bed_status(const bool blink) {
_draw_heater_status(H_BED, TERN0(HAS_LEVELING, blink && planner.leveling_active) ? '_' : LCD_STR_BEDTEMP[0], blink);
}
@ -835,6 +853,9 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(LASER_COOLANT_FLOW_METER)
_draw_flowmeter_status();
#endif
#if ENABLED(I2C_AMMETER)
_draw_ammeter_status();
#endif
#endif // LCD_WIDTH >= 20