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
78be2cbd
Commit
78be2cbd
authored
Apr 18, 2015
by
Simone Primarosa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a value to store the Power on time
parent
6440ed0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
temperature.cpp
MarlinKimbra/temperature.cpp
+12
-4
No files found.
MarlinKimbra/temperature.cpp
View file @
78be2cbd
...
@@ -781,6 +781,9 @@ static float analog2tempBed(int raw) {
...
@@ -781,6 +781,9 @@ static float analog2tempBed(int raw) {
/* Called to get the raw values into the the actual temperatures. The raw values are created in interrupt context,
/* Called to get the raw values into the the actual temperatures. The raw values are created in interrupt context,
and this function is called from normal context as it is too slow to run in interrupts and will block the stepper routine otherwise */
and this function is called from normal context as it is too slow to run in interrupts and will block the stepper routine otherwise */
static
void
updateTemperaturesFromRawValues
()
{
static
void
updateTemperaturesFromRawValues
()
{
static
millis_t
last_update
=
millis
();
millis_t
temp_last_update
=
millis
();
millis_t
from_last_update
=
temp_last_update
-
last_update
;
#ifdef HEATER_0_USES_MAX6675
#ifdef HEATER_0_USES_MAX6675
current_temperature_raw
[
0
]
=
read_max6675
();
current_temperature_raw
[
0
]
=
read_max6675
();
#endif
#endif
...
@@ -796,17 +799,22 @@ static void updateTemperaturesFromRawValues() {
...
@@ -796,17 +799,22 @@ static void updateTemperaturesFromRawValues() {
#endif
#endif
#if HAS_POWER_CONSUMPTION_SENSOR
#if HAS_POWER_CONSUMPTION_SENSOR
static
float
watt_overflow
=
0.0
;
static
float
watt_overflow
=
0.0
;
static
millis_t
last_power_update
=
millis
();
millis_t
temp_last_power_update
=
millis
();
power_consumption_meas
=
analog2power
();
power_consumption_meas
=
analog2power
();
//MYSERIAL.println(analog2current(),3);
//MYSERIAL.println(analog2current(),3);
watt_overflow
+=
(
power_consumption_meas
*
(
temp_last_power_update
-
last_power_update
)
)
/
3600000.0
;
watt_overflow
+=
(
power_consumption_meas
*
from_last_update
)
/
3600000.0
;
if
(
watt_overflow
>=
1.0
)
{
if
(
watt_overflow
>=
1.0
)
{
power_consumption_hour
++
;
power_consumption_hour
++
;
watt_overflow
--
;
watt_overflow
--
;
}
}
last_power_update
=
temp_last_power_update
;
#endif
#endif
static
unsigned
int
second_overflow
=
0
;
second_overflow
+=
from_last_update
;
if
(
second_overflow
>=
1000
)
{
printer_usage_seconds
++
;
second_overflow
-=
1000
;
}
last_update
=
temp_last_update
;
//Reset the watchdog after we know we have a temperature measurement.
//Reset the watchdog after we know we have a temperature measurement.
watchdog_reset
();
watchdog_reset
();
...
...
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