Commit ee9722e2 authored by Lisandro Damián Nicanor Pérez Meyer's avatar Lisandro Damián Nicanor Pérez Meyer
Browse files

Merge branch 'release/0.0.3'

parents cb8fa7f4 25bc027b
......@@ -11,7 +11,7 @@
#include <inttypes.h>
#include <Arduino.h>
#define FIRMWARE_VERSION "0.0.2"
#define FIRMWARE_VERSION "0.0.3"
#define HARDWARE_VERSION "0.0.1"
#define USE_WIFI_SECURE FALSE
......@@ -35,7 +35,6 @@
#define MIN_DATA_CONFIDENCE 95
#define SENSOR_HUB_WAIT_DATA_MAX 10
#define SENSOR_CONFIG_ERROR_COUNT 10
#define MQTT_CONNECTION_ATTEMPTS 100
#define DELAY_INIT_SETUP_MS 100
#define DELAY_CONFIGURATION_STATUS_MS 100
......
......@@ -36,6 +36,7 @@ public:
private:
static constexpr char* HEARTBEAT_TOPIC = "datakeeper/heartbeat";
static constexpr int MQTT_CONNECTION_ATTEMPTS = 5;
void subscriptionCallback(const char * topic, byte* payload, unsigned int length);
MQTT_CALLBACK_SIGNATURE;
time_t _lastNtpSync;
......
mosimpa-monitor (0.0.3) mosimpa; urgency=medium
* Decrease the number of MQTT server connection attempts to 5 (GitLab: #24).
- Make the constant private to MqttClient, as there is no need ot have it
somewhere else.
* Remove various components from MAX32664A's bioData struct:
- statusByte: this value was used when we retrieved only one value from the
queue, now that we get multiple values we use it only internally.
- irLed, redLed and the "algorithm mode 2" values: we are using mode 1, so
we are not retrievng them. This saves us quite some bytes of RAM.
* Fix battery measuring algorithm.
* Keep trying to reconnect to WiFi if the network is not available upon first
start (GitLab: #29).
* Present the WiFI MAC address upon client start to help identify the board.
See https://gitlab.com/mosimpa/documentation/-/issues/162
* MqttClient.cpp: better identify the ID as the MQTT client ID.
-- Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com> Thu, 29 Apr 2021 11:51:10 -0300
mosimpa-monitor (0.0.2) mosimpa; urgency=medium
* Use the NTP server provided by our server.
......
......@@ -14,6 +14,7 @@
#include <Wire.h>
#include <Ticker.h>
#include <ESPmDNS.h>
#include <WiFi.h>
#include "printf.h"
#include "Configuration.h"
......@@ -196,9 +197,9 @@ void configureWifi()
printfn("\tpass = %s", Configuration.getPass());
printfn("\tmqtthostname = %s", Configuration.getMqttHostname());
printfn("\tmqttport = %u", Configuration.getMqttPort());
printfn("MAC address: %s", WiFi.macAddress().c_str());
isDeviceConfigured = mqttClientInitialize();
if (isDeviceConfigured)
if (mqttClientInitialize())
{
publishInfoDevice();
tickerPublishDeviceInfo.attach(PERIOD_PUBLISH_INFO_DEVICE_SEC,
......@@ -359,7 +360,7 @@ void waitForSerialCommand()
bool mqttClientInitialize(void)
{
String id = mqttClient.getID().c_str();
printfn("ID: %s", id.c_str());
printfn("MQTT client ID: %s", id.c_str());
if(!mqttClient.connectWifi(Configuration.getSSID(), Configuration.getPass()))
return false;
......@@ -413,15 +414,17 @@ bool mqttClientConnectionStatus(void)
* \f$V_{Bat}=11*V_{Div}\f$
*
* The ADC is <a href="https://github.com/espressif/esp-idf/issues/164">non linear</a>
* so by using the approximation in the link above:
*
* \f$V_{Bat}=-1.6478E-7*(V_{Div})^{2}+3.23246E-3+0.337436\f$
*
* but in error in the region of operation seems beareable.
*/
uint16_t battmV()
{
const auto read = analogRead(BATTERY_VOLTAGE_GPIO);
return static_cast<uint16_t>(-1.6478e-7*read*read + 3.23246e-3*read + 0.337436);
static const int NUM_OF_SAMPLES = 5;
uint32_t sum = 0;
for(int i = 0; i < NUM_OF_SAMPLES; i++)
sum += 11 * analogRead(BATTERY_VOLTAGE_GPIO);
return static_cast<uint16_t>(sum / NUM_OF_SAMPLES);
}
/**
......
......@@ -14,17 +14,10 @@
/*@{*/
struct bioData {
uint32_t irLed;
uint32_t redLed;
uint16_t heartRate; ///< LSB = 0.1bpm
uint8_t confidence; ///< 0-100% LSB = 1%
uint8_t statusByte; ///< Communication status byte.
uint16_t oxygen; ///< 0-1000 0.1% LSB = 0.1%
uint8_t status; ///< 0: Success, 1: Not Ready, 2: Object Detectected, 3: Finger Detected
float rValue; ///< -- Algorithm Mode 2 vv
int8_t extStatus; ///< --
uint8_t reserveOne; ///< --
uint8_t resserveTwo; ///< -- Algorithm Mode 2 ^^
uint8_t confidence; ///< 0-100% LSB = 1%
uint8_t status; ///< 0: Success, 1: Not Ready, 2: Object Detected, 3: Finger Detected.
};
/*@}*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment