Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
medidor_uv
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
Model registry
Operate
Environments
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
desinfeccion_uv
medidor_uv
Commits
c5c7ca70
Commit
c5c7ca70
authored
4 years ago
by
Sebastián Fernández
Browse files
Options
Downloads
Patches
Plain Diff
paso a flotante valores a guardar en la memoria
parent
cef42a45
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sw/prototipo_0/uv_meter_setup_arduino/un_meter_setup_arduino/un_meter_setup_arduino.ino
+18
-18
18 additions, 18 deletions
...arduino/un_meter_setup_arduino/un_meter_setup_arduino.ino
with
18 additions
and
18 deletions
sw/prototipo_0/uv_meter_setup_arduino/un_meter_setup_arduino/un_meter_setup_arduino.ino
+
18
−
18
View file @
c5c7ca70
...
...
@@ -65,7 +65,7 @@ int front_position = LOW; // HIGH when present
// EEPROM
// define the number of byte needed
#define ADD_POWER_RAW 0 // address 0 and 1 store radiation power (4 bytes)
#define ADD_ON_TIME 4 // address 1 and 2 store TIME on
decens of
minutes (4 bytes)
#define ADD_ON_TIME 4 // address 1 and 2 store TIME on minutes (4 bytes)
#define ADD_CAL_G 8 // address 3 and 4 store Calibration parameter 1 (4 bytes)
#define ADD_CAL_O 12 // address 5 and 6 store Calibration parameter 1 (4 bytes)
#define EEPROM_SIZE 20 //
...
...
@@ -76,8 +76,8 @@ float radiation_power = 1.0;
float
calibration_gain
=
1.0
;
float
calibration_offset
=
1.0
;
float
f
dec_
minutes_on
=
0
;
int
i
dec_
minutes_on
=
0
;
float
fminutes_on
=
0
;
int
iminutes_on
=
0
;
float
scaleRadiationPower
(
float
radiation_raw
)
{
...
...
@@ -122,27 +122,27 @@ if (Serial.available() > 0)
inData
[
indexData
]
=
incomingByte
;
indexData
++
;
}
Serial
.
print
(
"index data máximo: "
);
Serial
.
println
(
indexData
);
//
Serial.print("index data máximo: ");
//
Serial.println(indexData);
if
(
inData
[
0
]
==
'r'
)
//r
{
Serial
.
println
(
"===== comando recibido: leer eeprom ===== "
);
// formato mensaje: r
Serial
.
print
(
"Potencia guardada: "
);
Serial
.
print
(
"Potencia
RAW
guardada
: "
);
EEPROM
.
get
(
ADD_POWER_RAW
,
radiation_power_raw
);
radiation_power
=
scaleRadiationPower
(
radiation_power_raw
);
Serial
.
println
(
radiation_power
);
Serial
.
print
(
"Horas encendido: "
);
EEPROM
.
get
(
ADD_ON_TIME
,
f
dec_
minutes_on
);
Serial
.
println
(
f
dec_
minutes_on
/
6
);
Serial
.
print
(
"Horas encendido
: "
);
EEPROM
.
get
(
ADD_ON_TIME
,
fminutes_on
);
Serial
.
println
(
fminutes_on
/
6
0
);
Serial
.
print
(
"Coeficiente ganancia: "
);
Serial
.
print
(
"Coeficiente ganancia
: "
);
EEPROM
.
get
(
ADD_CAL_G
,
calibration_gain
);
Serial
.
println
(
calibration_gain
);
Serial
.
print
(
"Coeficiente offset: "
);
Serial
.
print
(
"Coeficiente offset
: "
);
EEPROM
.
get
(
ADD_CAL_O
,
calibration_offset
);
Serial
.
println
(
calibration_offset
);
}
...
...
@@ -150,18 +150,18 @@ if (Serial.available() > 0)
if
(
inData
[
0
]
==
'h'
)
//h
{
Serial
.
println
(
"===== comando recibido: setear horas encendido ===== "
);
// formato mensaje: h,
decenas_
minutos
int
decenas_
minutos_on
=
1
;
// formato mensaje: h,minutos
int
minutos_on
=
1
;
bool
recepcion_ok
=
false
;
for
(
int
j
=
2
;
j
<
indexData
;
j
=
j
+
1
)
{
readString
+=
inData
[
j
];
}
if
(
readString
)
{
decenas_
minutos_on
=
round
(
readString
.
toInt
());
Serial
.
print
(
"
Decenas de m
inutos a grabar en EEPROM: "
);
Serial
.
println
(
decenas_
minutos_on
);
f
dec_
minutes_on
=
(
float
)
decenas_
minutos_on
;
EEPROM
.
put
(
ADD_ON_TIME
,
f
dec_
minutes_on
);
minutos_on
=
round
(
readString
.
toInt
());
Serial
.
print
(
"
M
inutos a grabar en EEPROM: "
);
Serial
.
println
(
minutos_on
);
fminutes_on
=
(
float
)
minutos_on
;
EEPROM
.
put
(
ADD_ON_TIME
,
fminutes_on
);
EEPROM
.
commit
();
recepcion_ok
=
true
;
}
...
...
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