Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
athome_firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iSPOT
athome_firmware
Commits
f75e8733
Commit
f75e8733
authored
4 years ago
by
Vassily Petrov
Browse files
Options
Downloads
Patches
Plain Diff
added cutoff when battery voltage is too low
parent
4288008d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
athome_firmware.cpp
+37
-5
37 additions, 5 deletions
athome_firmware.cpp
athome_firmware.h
+1
-0
1 addition, 0 deletions
athome_firmware.h
defs.h
+2
-1
2 additions, 1 deletion
defs.h
with
40 additions
and
6 deletions
athome_firmware.cpp
+
37
−
5
View file @
f75e8733
...
...
@@ -9,6 +9,7 @@
#include
<avr/boot.h>
#include
<EEPROM.h>
#include
<avr/wdt.h>
#include
<avr/sleep.h>
#include
"athome_firmware.h"
#include
"photo_measure.h"
...
...
@@ -93,7 +94,7 @@ void main_a()
Wire
.
begin
();
analogReference
(
EXTERNAL
);
pinMode
(
5
,
OUTPUT
);
// heater
pinMode
(
HEATER
,
OUTPUT
);
// heater
pinMode
(
2
,
OUTPUT
);
pinMode
(
UV_LED
,
OUTPUT
);
pinMode
(
7
,
OUTPUT
);
//Blue Led
...
...
@@ -102,7 +103,7 @@ void main_a()
pinMode
(
16
,
OUTPUT
);
digitalWrite
(
7
,
HIGH
);
digitalWrite
(
UV_LED
,
LOW
);
digitalWrite
(
5
,
LOW
);
// heater
digitalWrite
(
HEATER
,
LOW
);
// heater
digitalWrite
(
2
,
LOW
);
Wire
.
beginTransmission
(
0x48
);
...
...
@@ -193,7 +194,7 @@ void main_a()
// calibration mode.
MCUSR
=
0
;
wdt_disable
();
pinMode
(
5
,
LOW
);
// disable heater just in case.
digitalWrite
(
HEATER
,
LOW
);
// disable heater just in case.
u8g2
.
firstPage
();
do
...
...
@@ -226,7 +227,7 @@ void main_a()
// temp calibration measurement mode.
MCUSR
=
0
;
wdt_disable
();
pinMode
(
5
,
LOW
);
// disable heater just in case.
digitalWrite
(
HEATER
,
LOW
);
// disable heater just in case.
while
(
1
){
val
=
0
;
for
(
int
i
=
0
;
i
<
32
;
i
++
){
...
...
@@ -299,6 +300,12 @@ void main_a()
measure_trigger_delay
=
0
;
}
if
(
state
==
STATE_IDLE
&&
voltage
<
6.4
){
lowbatt
(
false
);
}
else
if
(
voltage
<
6
){
lowbatt
(
true
);
}
//delay(5);
}
}
...
...
@@ -370,6 +377,31 @@ void task_temp()
dirs_idx
=
next
;
power
=
int
(
max
(
0.0
,
min
(
POWER_MAX
,
P
*
(
setpoint
-
temp
)
+
I
*
(
integ
/
100
)
+
D
*
(
10
*
dirs_sum
))));
}
analogWrite
(
5
,
power
);
analogWrite
(
HEATER
,
power
);
}
void
lowbatt
(
boolean
disablescreen
)
{
digitalWrite
(
HEATER
,
LOW
);
// disable heater
digitalWrite
(
UV_LED
,
LOW
);
// disable illimunator
digitalWrite
(
7
,
LOW
);
//Blue Led
digitalWrite
(
8
,
LOW
);
// Button
digitalWrite
(
9
,
LOW
);
// Green Led
u8g2
.
firstPage
();
do
{
u8g2
.
setDrawColor
(
1
);
u8g2
.
setFont
(
FONT
);
u8g2
.
drawStr
(
14
,
39
,
"LOW BATT"
);
}
while
(
u8g2
.
nextPage
());
MCUSR
=
0
;
wdt_disable
();
cli
();
set_sleep_mode
(
SLEEP_MODE_PWR_DOWN
);
while
(
1
)
sleep_mode
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
athome_firmware.h
+
1
−
0
View file @
f75e8733
...
...
@@ -3,5 +3,6 @@
void
main_a
();
void
task_temp
();
void
lowbatt
(
boolean
disablescreen
);
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
defs.h
+
2
−
1
View file @
f75e8733
...
...
@@ -13,6 +13,7 @@
#define FAN 16
#define UV_LED 6
#define HEATER 5
// led plugged into fan temporarily
//#define UV_LED 16
...
...
@@ -25,6 +26,6 @@
#define POWER_MAX 50.0
#define FONT u8g2_font_helvR14_tr
#define VERSION 2
5
#define VERSION 2
6
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment