Skip to content

Commit

Permalink
Merge pull request #13 from renanrms/publishing-changes-2
Browse files Browse the repository at this point in the history
Fix: Mais ajustes para publicação da Lib.
  • Loading branch information
renanrms authored Aug 31, 2023
2 parents c1566cc + e621884 commit 9000fe3
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 35 deletions.
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"ftrlab",
"gmag11",
"gpio",
"hcsr04",
"mdns",
"microcontroller",
"platformio",
Expand Down
2 changes: 1 addition & 1 deletion examples/distance-laser/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
lib_deps =
renanrms/FTRLab
../../
adafruit/Adafruit_VL53L0X@^1.2.2
14 changes: 6 additions & 8 deletions examples/distance-laser/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ Preferences ftrlabPreferences;
*/
enum PINS
{
NETWORK_RECONFIGURATION_BUTTON = 5,
NETWORK_STATUS_LED = 18,
CONFIGURATION_BUTTON = 5,
STATUS_LED = 18,
// Adicione aqui outros pinos utilizados pela placa
ULTRASONIC_SENSOR_TRIGGER = 12,
ULTRASONIC_SENSOR_ECHO = 13,
SENSOR_SDA = 21,
SENSOR_SCL = 22,
};

void setup()
{
// Configuração de sensores, informações e pinos escolhidos para o dispositivo
device.setName("Distância VL53X0L");
device.addSensor(new VL53L0X(PINS::ULTRASONIC_SENSOR_TRIGGER, PINS::ULTRASONIC_SENSOR_ECHO));
device.setDevicePins(
PINS::NETWORK_RECONFIGURATION_BUTTON,
PINS::NETWORK_STATUS_LED);
device.addSensor(new VL53L0X(PINS::SENSOR_SDA, PINS::SENSOR_SCL));
device.setDevicePins(PINS::CONFIGURATION_BUTTON, PINS::STATUS_LED);

// Configurações opcionais
device.setTargetSampleRate(30);
Expand Down
6 changes: 3 additions & 3 deletions examples/distance-laser/src/sensors/VL53L0X.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
class VL53L0X : public Sensor
{
public:
uint8_t triggerPin;
uint8_t echoPin;
uint8_t sdaPin;
uint8_t sclPin;
Adafruit_VL53L0X lox = Adafruit_VL53L0X();

VL53L0X(uint8_t triggerPin, uint8_t echoPin)
VL53L0X(uint8_t sdaPin, uint8_t sclPin)
{
this->quantity = "distance";
this->method = "Laser";
Expand Down
16 changes: 7 additions & 9 deletions examples/distance-ultrasound/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "FTRLab.hpp"

#include "sensors/UltrasonicSensor.cpp"
#include "sensors/HCSR04.cpp"

Preferences ftrlabPreferences;

Expand All @@ -10,21 +10,19 @@ Preferences ftrlabPreferences;
*/
enum PINS
{
NETWORK_RECONFIGURATION_BUTTON = 5,
NETWORK_STATUS_LED = 18,
CONFIGURATION_BUTTON = 5,
STATUS_LED = 18,
// Adicione aqui outros pinos utilizados pela placa
ULTRASONIC_SENSOR_TRIGGER = 12,
ULTRASONIC_SENSOR_ECHO = 13,
TRIGGER = 12,
ECHO = 13,
};

void setup()
{
// Configuração de sensores, informações e pinos escolhidos para o dispositivo
device.setName("Distância HC-SR04");
device.addSensor(new UltrasonicSensor(PINS::ULTRASONIC_SENSOR_TRIGGER, PINS::ULTRASONIC_SENSOR_ECHO));
device.setDevicePins(
PINS::NETWORK_RECONFIGURATION_BUTTON,
PINS::NETWORK_STATUS_LED);
device.addSensor(new HCSR04(PINS::TRIGGER, PINS::ECHO));
device.setDevicePins(PINS::CONFIGURATION_BUTTON, PINS::STATUS_LED);

// Configurações opcionais
device.setTargetSampleRate(80);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const double SOUND_SPEED = 343; // Unit: m/s
const double MAXIMUM_MEASURABLE_DISTANCE = 5; // Unit: m
const double MINIMUM_MEASURABLE_DISTANCE = 0.03; // Unit: m

class UltrasonicSensor : public Sensor
class HCSR04 : public Sensor
{
public:
uint8_t triggerPin;
uint8_t echoPin;

UltrasonicSensor(uint8_t triggerPin, uint8_t echoPin)
HCSR04(uint8_t triggerPin, uint8_t echoPin)
{
this->quantity = "distance";
this->method = "Ultrassônico";
Expand Down
12 changes: 5 additions & 7 deletions examples/esp32BuiltinSensors/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "FTRLab.hpp"

#include "sensors/HallEffectSensor.cpp"
#include "sensors/TemperatureBuiltInSensor.cpp"
#include "sensors/TemperatureSensor.cpp"

Preferences ftrlabPreferences;

Expand All @@ -11,19 +11,17 @@ Preferences ftrlabPreferences;
*/
enum PINS
{
NETWORK_RECONFIGURATION_BUTTON = 5,
NETWORK_STATUS_LED = 18,
CONFIGURATION_BUTTON = 5,
STATUS_LED = 18,
};

void setup()
{
// Configuração de sensores, informações e pinos escolhidos para o dispositivo
device.setName("ESP32 Built-in");
device.addSensor(new HallEffectSensor());
device.addSensor(new TemperatureBuiltInSensor());
device.setDevicePins(
PINS::NETWORK_RECONFIGURATION_BUTTON,
PINS::NETWORK_STATUS_LED);
device.addSensor(new TemperatureSensor());
device.setDevicePins(PINS::CONFIGURATION_BUTTON, PINS::STATUS_LED);

// Configurações opcionais
device.setTargetSampleRate(40);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ extern "C"
// cspell:disable-next-line
uint8_t temprature_sens_read();

class TemperatureBuiltInSensor : public Sensor
class TemperatureSensor : public Sensor
{
public:
TemperatureBuiltInSensor()
TemperatureSensor()
{
this->quantity = "temperature";
this->method = "Temperatura da CPU";
Expand Down
13 changes: 10 additions & 3 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,28 @@
"name": "distance-laser",
"base": "examples/distance-laser",
"files": [
"**"
"platformio.ini",
"src/main.cpp",
"src/sensors/VL53L0X.cpp"
]
},
{
"name": "distance-ultrasound",
"base": "examples/distance-ultrasound",
"files": [
"**"
"platformio.ini",
"src/main.cpp",
"src/sensors/HCSR04.cpp"
]
},
{
"name": "esp32BuiltinSensors",
"base": "examples/esp32BuiltinSensors",
"files": [
"**"
"platformio.ini",
"src/main.cpp",
"src/sensors/HallEffectSensor.cpp",
"src/sensors/TemperatureSensor.cpp"
]
}
]
Expand Down

0 comments on commit 9000fe3

Please sign in to comment.