Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
neOCampus-arduino
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
GIS-neOCampus
neOSensor
neOCampus-arduino
Commits
a12fafce
Commit
a12fafce
authored
1 year ago
by
Manon MALIQUE
Browse files
Options
Downloads
Patches
Plain Diff
Displaying of corrections values
parent
65fe153a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
neosensor/libraries/neocampus_drivers/generic_driver.cpp
+1
-1
1 addition, 1 deletion
neosensor/libraries/neocampus_drivers/generic_driver.cpp
neosensor/neosensor.ino
+62
-1
62 additions, 1 deletion
neosensor/neosensor.ino
with
63 additions
and
2 deletions
neosensor/libraries/neocampus_drivers/generic_driver.cpp
+
1
−
1
View file @
a12fafce
...
...
@@ -172,7 +172,7 @@ void generic_driver::calibrate(float* pval, float a, float b){
*
pval
=
*
pval
+
b
;
log_debug
(
F
(
"
\n
[generic_drivers][calibration] Calibration effectuée ! a="
));
log_debug
(
a
);
log_debug
(
F
(
"
\n
; b="
));
log_debug
(
F
(
" ; b="
));
log_debug
(
b
);
log_flush
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
neosensor/neosensor.ino
+
62
−
1
View file @
a12fafce
...
...
@@ -121,12 +121,24 @@
// WiFi parameters management
#include
"wifiParametersMgt.h"
//Manon
//BLE device
#include
<M5StickCPlus.h>
#include
<BLEDevice.h>
#include
<BLEUtils.h>
#include
<BLEScan.h>
#include
<BLEAdvertisedDevice.h>
/*
* Definitions
*/
//Manon
#define SCAN_TIME 5 // scan period in second
bool
BLEScanActivated
=
false
;
#define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8))
// Debug related definitions
#define SERIAL_BAUDRATE 115200
#ifdef ESP8266
...
...
@@ -777,6 +789,49 @@ void lateSetup( void ) {
log_info
(
F
(
"
\n
# --- --- ---"
));
log_flush
();
}
//Manon
// ***** start BLE scan *****
void
startScanBLE
()
{
BLEScan
*
pBLEScan
=
BLEDevice
::
getScan
();
// start scanning
pBLEScan
->
setAdvertisedDeviceCallbacks
(
new
Advertised
(),
true
);
pBLEScan
->
setActiveScan
(
true
);
pBLEScan
->
start
(
SCAN_TIME
,
scanCompleteCB
);
BLEScanActivated
=
true
;
}
// ***** scan Complete Call Back *****
static
void
scanCompleteCB
(
BLEScanResults
scanResults
)
{
// Callback invoked when scanning has completed
BLEScanActivated
=
false
;
}
// ***** manage BLE scan *****
void
manageBLEscan
()
{
if
(
!
BLEScanActivated
)
startScanBLE
();
// start scanning
}
// ***** getTemperature *****
float
getTemperature
(
BLEAdvertisedDevice
device
)
{
uint8_t
temp_lb
=
(
uint8_t
)
device
.
getManufacturerData
().
c_str
()[
1
];
// temperature lower byte
uint8_t
temp_hb
=
(
uint8_t
)(
device
.
getManufacturerData
().
c_str
()[
2
]);
// temperature higher byte
int16_t
temperature
=
(
int16_t
)((
uint16_t
)(
temp_hb
)
<<
8
)
+
(
uint16_t
)
temp_lb
;
return
((
float
)(
temperature
)
/
10
);
}
// ***** getHumidity *****
uint8_t
getHumidity
(
BLEAdvertisedDevice
device
)
{
const
uint8_t
*
pHum
=
(
const
uint8_t
*
)
&
device
.
getManufacturerData
().
c_str
()[
3
];
return
*
pHum
;
}
void
onResult
(
BLEAdvertisedDevice
device
)
{
log_debug
(
F
(
"
\n
Reference temperature : "
));
log_debug
(
getTemperature
(
device
));
log_debug
(
F
(
"
\n
Reference humidity : "
));
log_debug
(
getHumidity
(
device
));
log_flush
();
return
;
}
// --- SETUP -------------------------------------------------------------------
void
setup
()
{
...
...
@@ -1187,7 +1242,13 @@ if( res!=uint8_t(0x44) ) {
*/
modulesList
.
startAll
(
&
sensocampus
,
sharedRoot
);
//Manon
//Init BLE
BLEDevice
::
init
(
""
);
manageBLEscan
();
log_debug
(
F
(
"
\n
Setup of BLE device ..."
));
log_flush
();
delay
(
1000
);
log_debug
(
F
(
" done !"
));
log_flush
();
/*
* Very end of setup() :)
*/
...
...
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