Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Дмитрий Решетей
/
OREGON
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 99744fd2
authored
Mar 05, 2020
by
Дмитрий Решетей
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Editet BATTERY FLAG separated PCR and WRT sensor. Correct output data from PCR sensor
1 parent
3a75f630
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
libraries/Oregon_NR-master/Oregon_NR.cpp
wifi_reciver/wifi_reciver.ino
libraries/Oregon_NR-master/Oregon_NR.cpp
View file @
99744fd
This diff is collapsed.
Click to expand it.
wifi_reciver/wifi_reciver.ino
View file @
99744fd
...
...
@@ -24,9 +24,7 @@
#define CONNECT_TIMEOUT 10000 //Время ожидания соединения
#define DISCONNECT_TIMEOUT 10000 //Время ожидания отсоединения
//#define mac "#FF:FF:FF:FF:FF:FF" //МАС-адрес на narodmon.ru d8-f1-5b-07-1c-0b
//#define mac "#D8:F1:5B:07:1C:0B" //МАС-адрес на narodmon.ru d8-f1-5b-07-1c-0b
#define mac "#ESP826677671C0B" //МАС-адрес на narodmon.ru d8-f1-5b-07-1c-0b
//#define mac "#ESP8266FFFFFFFF" //ID или MAC на narodmon.ru
...
...
@@ -46,7 +44,7 @@ Oregon_NR oregon(13, 13, 2, true); // Приёмник 433Мгц подключ
//Массивы для хранения полученных данных для датчиков Oregon:
float
r_tmp
[
3
];
//Температура
float
r_hmdty
[
3
];
//Влажность. Если = 101 - значит нет данных
bool
r_bat
[
3
],
bat_
;
//Флаг батареи
bool
r_bat
[
3
],
bat_
pcr
,
bat_wrt
;
//Флаг батареи
bool
r_isreceived
[
3
];
//Флаг о том, что по данному каналу приходил хоть один правильный пакет и данные актуальны
word
r_type
[
3
];
//Тип датчика
...
...
@@ -294,7 +292,7 @@ if (oregon.sens_type == WGR800 && oregon.crc_c){
r_bat
[
_chnl
]
=
oregon
.
sens_battery
;
r_isreceived
[
_chnl
]
=
1
;
//r_tmp[_chnl] = r_tmp[_chnl] * ((number_of_receiving[_chnl] - 1) / number_of_receiving[_chnl]) + oregon.sens_tmp / number_of_receiving[_chnl];
bat_
=
oregon
.
sens_battery
;
bat_
wrt
=
oregon
.
sens_battery
;
wa_speed
=
oregon
.
sens_avg_ws
;
mw_speed
=
oregon
.
sens_max_ws
;
// translate rumb to direction in DEG
...
...
@@ -343,7 +341,7 @@ if (oregon.sens_type == WGR800 && oregon.crc_c){
//Serial.print("checksumm = ");
//Serial.print(oregon.crc_c, HEX);
//Serial.print(oregon.sens_id);
bat_
=
oregon
.
sens_battery
;
bat_
pcr
=
oregon
.
sens_battery
;
r_rate
=
oregon
.
rain_rate
;
r_total
=
oregon
.
total_rain
;
}
...
...
@@ -427,7 +425,7 @@ bool send_data() {
Serial
.
println
(
' '
);
String
s
=
mac
;
Serial
.
print
(
s
);
if
(
!
TEST_MODE
)
client
.
print
ln
(
s
);
if
(
!
TEST_MODE
)
client
.
print
(
s
);
// if (TEST_MODE) Serial.println(s);
// if (TEST_MODE) Serial.println("YOU IN TEST MODE !!!!!!!!!!!");
// if (TEST_MODE) Serial.println("YOU IN TEST MODE !!!!!!!!!!!");
...
...
@@ -436,7 +434,7 @@ bool send_data() {
sendOregonData
();
//Завершаем передачу
client
.
print
ln
(
"##"
);
client
.
print
(
"##"
);
Serial
.
println
(
"##"
);
//Ждём отключения клиента
cur_mark
=
millis
();
...
...
@@ -492,7 +490,7 @@ void sendOregonData() {
if
(
!
TEST_MODE
)
client
.
print
(
s
);
// v battery
s
=
"
\n
#VBAT1#"
;
switch
(
bat_
)
{
switch
(
bat_
wrt
)
{
case
1
:
{
s
+=
" 99"
;
break
;}
default:
s
+=
" 50"
;
}
...
...
@@ -502,30 +500,30 @@ void sendOregonData() {
//#####################################
// PCR800 rain deviation - especially for narodmon.ru #######################################
float
rain_deviation
;
// rain_deviation
//r_rate = oregon.rain_rate;
//r_total = oregon.total_rain;
//rain_deviation = random(1, 3) * 0.0025;
//
total_rain_deviation = random(1, 3) * 0.0001;
//
float rain_deviation; // rain_deviation
//
r_rate = oregon.rain_rate;
//
r_total = oregon.total_rain;
//
rain_deviation = random(1, 3) * 0.0025;
//
total_rain_deviation = random(1, 3) * 0.0001;
// PCR800 rain rate ########################################################################
s
=
"
\n
#RAIN1#"
;
// r_rate += rain_deviation; // addin deviation of last digit - .00$ - important for narodmon.ru
// r_rate += rain_deviation; // addin deviation of last digit - .00$ - important for narodmon.ru
r_rate
+=
random
(
0
,
3
)
*
0.0026
;
s
+=
String
(
r_rate
,
4
);
// show .000 digits - important for narodmon.ru
Serial
.
println
(
s
);
if
(
!
TEST_MODE
)
client
.
print
(
s
);
// PCR800 total rain ######################################################################
s
=
"
\n
#RAIN2#"
;
// r_total += rain_deviation;
r_total
+=
random
(
-
1
,
1
)
*
0.0025
;
// r_total += rain_deviation;
r_total
+=
random
(
0
,
3
)
*
0.0026
;
s
+=
String
(
r_total
,
4
);
// show .0000 digits - for narodmon.ru
Serial
.
println
(
s
);
if
(
!
TEST_MODE
)
client
.
print
(
s
);
// v battery
s
=
"
\n
#VBAT2#"
;
//s += bat_;
switch
(
bat_
)
{
switch
(
bat_
pcr
)
{
case
1
:
{
s
+=
" 99"
;
break
;}
default:
s
+=
" 50"
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment