Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MarlinKimbra
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
MarlinKimbra
Commits
48e1664e
Commit
48e1664e
authored
9 years ago
by
MagoKimbra
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #34 from simone97/master
Power Consumption LCD Update + code clean
parents
2f1d9332
5f46d324
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
39 deletions
+102
-39
Conditionals.h
MarlinKimbra/Conditionals.h
+6
-0
ConfigurationStore.cpp
MarlinKimbra/ConfigurationStore.cpp
+13
-1
Marlin.h
MarlinKimbra/Marlin.h
+2
-0
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+16
-6
dogm_lcd_implementation.h
MarlinKimbra/dogm_lcd_implementation.h
+22
-8
ultralcd.cpp
MarlinKimbra/ultralcd.cpp
+20
-15
ultralcd_implementation_hitachi_HD44780.h
MarlinKimbra/ultralcd_implementation_hitachi_HD44780.h
+23
-9
No files found.
MarlinKimbra/Conditionals.h
View file @
48e1664e
...
...
@@ -436,6 +436,12 @@
#if HAS_FAN
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
/**
* Shorthand for sensor test for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h
*/
#define HAS_LCD_FILAMENT_SENSOR (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY))
#define HAS_LCD_POWER_SENSOR (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
#endif //CONFIGURATION_LCD
#endif //CONDITIONALS_H
This diff is collapsed.
Click to expand it.
MarlinKimbra/ConfigurationStore.cpp
View file @
48e1664e
...
...
@@ -41,7 +41,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
// wrong data being written to the variables.
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
#define EEPROM_VERSION "V1
7
"
#define EEPROM_VERSION "V1
8
"
#ifdef EEPROM_SETTINGS
void
Config_StoreSettings
()
{
...
...
@@ -132,6 +132,10 @@ void Config_StoreSettings() {
#ifdef IDLE_OOZING_PREVENT
EEPROM_WRITE_VAR
(
i
,
idleoozing_enabled
);
#endif
#if defined(POWER_CONSUMPTION) && defined(STORE_CONSUMPTION)
EEPROM_WRITE_VAR
(
i
,
power_consumption_hour
);
#endif
int
storageSize
=
i
;
...
...
@@ -255,6 +259,10 @@ void Config_RetrieveSettings()
#ifdef IDLE_OOZING_PREVENT
EEPROM_READ_VAR
(
i
,
idleoozing_enabled
);
#endif
#if defined(POWER_CONSUMPTION) && defined(STORE_CONSUMPTION)
EEPROM_READ_VAR
(
i
,
power_consumption_hour
);
#endif
// Call updatePID (similar to when we have processed M301)
updatePID
();
...
...
@@ -400,6 +408,10 @@ void Config_ResetDefault()
#ifdef IDLE_OOZING_PREVENT
idleoozing_enabled
=
true
;
#endif
#if defined(POWER_CONSUMPTION) && defined(STORE_CONSUMPTION)
power_consumption_hour
=
0
;
#endif
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Hardcoded Default Settings Loaded"
);
...
...
This diff is collapsed.
Click to expand it.
MarlinKimbra/Marlin.h
View file @
48e1664e
...
...
@@ -307,6 +307,8 @@ extern int fanSpeed;
#if HAS_POWER_CONSUMPTION_SENSOR
extern
float
power_consumption_meas
;
//holds the power consumption as accurately measured
extern
unsigned
long
power_consumption_hour
;
//holds the power consumption per hour as accurately measured
extern
unsigned
long
startpower
;
extern
unsigned
long
stoppower
;
#endif
#ifdef IDLE_OOZING_PREVENT
...
...
This diff is collapsed.
Click to expand it.
MarlinKimbra/Marlin_main.cpp
View file @
48e1664e
...
...
@@ -340,8 +340,10 @@ uint8_t debugLevel = 0;
#endif
#if HAS_POWER_CONSUMPTION_SENSOR
float
power_consumption_meas
=
0
;
unsigned
long
power_consumption_hour
=
0.0
;
float
power_consumption_meas
=
0.0
;
unsigned
long
power_consumption_hour
=
0
;
unsigned
long
startpower
=
0
;
unsigned
long
stoppower
=
0
;
#endif
#ifdef LASERBEAM
...
...
@@ -927,13 +929,18 @@ void get_command()
{
if
(
card
.
eof
()){
SERIAL_PROTOCOLLNPGM
(
MSG_FILE_PRINTED
);
stoptime
=
millis
();
stoptime
=
millis
();
stoppower
=
power_consumption_hour
-
startpower
;
char
time
[
30
];
unsigned
long
t
=
(
stoptime
-
starttime
)
/
1000
;
unsigned
long
t
=
(
stoptime
-
starttime
)
/
1000
;
int
hours
,
minutes
;
minutes
=
(
t
/
60
)
%
60
;
hours
=
t
/
60
/
60
;
sprintf_P
(
time
,
PSTR
(
"%i "
MSG_END_HOUR
" %i "
MSG_END_MINUTE
),
hours
,
minutes
);
#if HAS_POWER_CONSUMPTION_SENSOR
sprintf_P
(
time
,
PSTR
(
"%i "
MSG_END_HOUR
" %i "
MSG_END_MINUTE
" %i Wh"
),
hours
,
minutes
,
stoppower
);
#else
sprintf_P
(
time
,
PSTR
(
"%i "
MSG_END_HOUR
" %i "
MSG_END_MINUTE
),
hours
,
minutes
);
#endif
SERIAL_ECHO_START
;
SERIAL_ECHOLN
(
time
);
lcd_setstatus
(
time
,
true
);
...
...
@@ -3625,6 +3632,7 @@ inline void gcode_G92() {
inline
void
gcode_M24
()
{
card
.
startFileprint
();
starttime
=
millis
();
startpower
=
power_consumption_hour
;
}
// M25: Pause SD Print
...
...
@@ -3715,8 +3723,10 @@ inline void gcode_M31() {
card
.
setIndex
(
code_value_long
());
card
.
startFileprint
();
if
(
!
call_procedure
)
if
(
!
call_procedure
)
{
starttime
=
millis
();
//procedure calls count as normal print time.
startpower
=
power_consumption_hour
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
MarlinKimbra/dogm_lcd_implementation.h
View file @
48e1664e
...
...
@@ -280,10 +280,23 @@ static void lcd_implementation_status_screen() {
u8g
.
setPrintPos
(
80
,
48
);
if
(
starttime
!=
0
)
{
uint16_t
time
=
(
millis
()
-
starttime
)
/
60000
;
lcd_print
(
itostr2
(
time
/
60
));
lcd_print
(
':'
);
lcd_print
(
itostr2
(
time
%
60
));
#if HAS_LCD_POWER_SENSOR
if
(
millis
()
<
print_millis
+
1000
)
{
uint16_t
time
=
(
millis
()
-
starttime
)
/
60000
;
lcd_print
(
itostr2
(
time
/
60
));
lcd_print
(
':'
);
lcd_print
(
itostr2
(
time
%
60
));
}
else
{
lcd_print
(
itostr4
(
power_consumption_hour
-
startpower
));
lcd_print
(
'
Wh
'
);
}
#else
uint16_t
time
=
(
millis
()
-
starttime
)
/
60000
;
lcd_print
(
itostr2
(
time
/
60
));
lcd_print
(
':'
);
lcd_print
(
itostr2
(
time
%
60
));
#endif
}
else
{
lcd_printPGM
(
PSTR
(
"--:--"
));
...
...
@@ -358,12 +371,13 @@ static void lcd_implementation_status_screen() {
#else
u8g
.
setPrintPos
(
0
,
63
);
#endif
#if HAS_FILAMENT_SENSOR || HAS_POWER_CONSUMPTION_SENSOR
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR
if
(
millis
()
<
message_millis
+
5000
)
{
//Display both Status message line and Filament display on the last line
lcd_print
(
lcd_status_message
);
}
#if HAS_
POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if HAS_
FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
#if HAS_
LCD_POWER_SENSOR
#if HAS_
LCD_FILAMENT_SENSOR
else
if
(
millis
()
<
message_millis
+
10000
)
#else
else
...
...
@@ -376,7 +390,7 @@ static void lcd_implementation_status_screen() {
lcd_printPGM
(
PSTR
(
"Wh"
));
}
#endif
#if HAS_
FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
#if HAS_
LCD_FILAMENT_SENSOR
else
{
lcd_printPGM
(
PSTR
(
"D:"
));
lcd_print
(
ftostr12ns
(
filament_width_meas
));
...
...
This diff is collapsed.
Click to expand it.
MarlinKimbra/ultralcd.cpp
View file @
48e1664e
...
...
@@ -33,10 +33,14 @@ int gumPreheatFanSpeed;
const
long
baudrates
[]
=
{
9600
,
14400
,
19200
,
28800
,
38400
,
56000
,
115200
,
250000
};
int
baudrate_position
=
-
1
;
#if
(HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
#if
HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR
unsigned
long
message_millis
=
0
;
#endif
#if HAS_LCD_POWER_SENSOR
unsigned
long
print_millis
=
0
;
#endif
/* !Configuration settings */
//Function pointer to menu functions.
...
...
@@ -314,6 +318,21 @@ static void lcd_status_screen()
lcd_implementation_status_screen
();
lcd_status_update_delay
=
10
;
/* redraw the main screen every second. This is easier then trying keep track of all things that change on the screen */
}
#if HAS_LCD_POWER_SENSOR
if
(
millis
()
>
print_millis
+
2000
)
print_millis
=
millis
();
#endif
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR
#if HAS_LCD_FILAMENT_SENSOR && HAS_LCD_POWER_SENSOR
if
(
millis
()
>
message_millis
+
15000
)
#else
if
(
millis
()
>
message_millis
+
10000
)
#endif
{
message_millis
=
millis
();
}
#endif
#ifdef ULTIPANEL
...
...
@@ -343,16 +362,6 @@ static void lcd_status_screen()
currentMenu
==
lcd_status_screen
#endif
);
#if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
#if (HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) && (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
if
(
millis
()
>
message_millis
+
15000
)
#else
if
(
millis
()
>
message_millis
+
10000
)
#endif
{
message_millis
=
millis
();
}
#endif
}
#ifdef ULTIPANEL_FEEDMULTIPLY
...
...
@@ -1618,10 +1627,6 @@ void lcd_finishstatus(bool persist=false) {
#endif
#endif
lcdDrawUpdate
=
2
;
#ifdef FILAMENT_LCD_DISPLAY
message_millis
=
millis
();
//get status message to show up for a while
#endif
}
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
...
...
This diff is collapsed.
Click to expand it.
MarlinKimbra/ultralcd_implementation_hitachi_HD44780.h
View file @
48e1664e
...
...
@@ -586,13 +586,27 @@ static void lcd_implementation_status_screen()
#endif //SDSUPPORT
#endif //LCD_WIDTH > 19
lcd
.
setCursor
(
LCD_WIDTH
-
6
,
2
);
lcd
.
print
(
LCD_STR_CLOCK
[
0
]);
if
(
starttime
!=
0
)
{
uint16_t
time
=
millis
()
/
60000
-
starttime
/
60000
;
lcd
.
print
(
itostr2
(
time
/
60
));
lcd
.
print
(
':'
);
lcd
.
print
(
itostr2
(
time
%
60
));
#if HAS_LCD_POWER_SENSOR
if
(
millis
()
<
print_millis
+
1000
)
{
lcd
.
print
(
LCD_STR_CLOCK
[
0
]);
uint16_t
time
=
millis
()
/
60000
-
starttime
/
60000
;
lcd
.
print
(
itostr2
(
time
/
60
));
lcd
.
print
(
':'
);
lcd
.
print
(
itostr2
(
time
%
60
));
}
else
{
lcd
.
print
(
itostr4
(
power_consumption_hour
-
startpower
));
lcd
.
print
(
'
Wh
'
);
}
#else
lcd
.
print
(
LCD_STR_CLOCK
[
0
]);
uint16_t
time
=
millis
()
/
60000
-
starttime
/
60000
;
lcd
.
print
(
itostr2
(
time
/
60
));
lcd
.
print
(
':'
);
lcd
.
print
(
itostr2
(
time
%
60
));
#endif
}
else
{
lcd_printPGM
(
PSTR
(
"--:--"
));
...
...
@@ -627,12 +641,12 @@ static void lcd_implementation_status_screen()
#endif //LCD_PROGRESS_BAR
//Display both Status message line and Filament display on the last line
#if
(HAS_FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)) || (HAS_POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY))
#if
HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR
if
(
millis
()
<
message_millis
+
5000
)
{
//Display both Status message line and Filament display on the last line
lcd_print
(
lcd_status_message
);
}
#if HAS_
POWER_CONSUMPTION_SENSOR && defined(POWER_CONSUMPTION_LCD_DISPLAY)
#if HAS_
FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
#if HAS_
LCD_POWER_SENSOR
#if HAS_
LCD_FILAMENT_SENSOR
else
if
(
millis
()
<
message_millis
+
10000
)
#else
else
...
...
@@ -645,7 +659,7 @@ static void lcd_implementation_status_screen()
lcd_printPGM
(
PSTR
(
"Wh"
));
}
#endif
#if HAS_
FILAMENT_SENSOR && defined(FILAMENT_LCD_DISPLAY)
#if HAS_
LCD_FILAMENT_SENSOR
else
{
lcd_printPGM
(
PSTR
(
"D:"
));
lcd
.
print
(
ftostr12ns
(
filament_width_meas
));
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment