Adding some Log messages
This commit is contained in:
@@ -6,8 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PinController.h"
|
#include "PinController.h"
|
||||||
|
|
||||||
#include "utility/config.h"
|
#include "utility/config.h"
|
||||||
|
#include "utility/LoggerFactory.h"
|
||||||
|
|
||||||
#ifndef NO_WIRING_PI
|
#ifndef NO_WIRING_PI
|
||||||
#include <wiringPi.h>
|
#include <wiringPi.h>
|
||||||
#include <mcp23017.h>
|
#include <mcp23017.h>
|
||||||
@@ -15,8 +16,6 @@
|
|||||||
#include "utility/wiringPiTesting.hpp"
|
#include "utility/wiringPiTesting.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "json/json.hpp"
|
|
||||||
|
|
||||||
namespace flippR_driver
|
namespace flippR_driver
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -24,6 +23,7 @@ std::once_flag PinController::GPIO_LIB_INITIALIZED;
|
|||||||
|
|
||||||
PinController::PinController()
|
PinController::PinController()
|
||||||
{
|
{
|
||||||
|
CLOG(INFO, OUTPUT_LOGGER) << "Created PinController";
|
||||||
std::call_once(GPIO_LIB_INITIALIZED, wiringPiSetup);
|
std::call_once(GPIO_LIB_INITIALIZED, wiringPiSetup);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +50,10 @@ bool PinController::read_pin(uint8_t address)
|
|||||||
void PinController::initialize_port_expander(const uint8_t i2c_address, const uint8_t pin_base)
|
void PinController::initialize_port_expander(const uint8_t i2c_address, const uint8_t pin_base)
|
||||||
{
|
{
|
||||||
mcp23017Setup(pin_base, i2c_address);
|
mcp23017Setup(pin_base, i2c_address);
|
||||||
|
char hex_string[4];
|
||||||
|
sprintf(hex_string, "%X", i2c_address);
|
||||||
|
CLOG(INFO, OUTPUT_LOGGER) << "MCP23017 initialized with i2c-address 0x" << hex_string << " and pin-base " << int(pin_base);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace input
|
|||||||
Event::Event(uint8_t address, int priority, std::string name) :
|
Event::Event(uint8_t address, int priority, std::string name) :
|
||||||
address(address), priority(priority), name(name)
|
address(address), priority(priority), name(name)
|
||||||
{
|
{
|
||||||
CLOG_IF(VLOG_IS_ON(0), INFO, INPUT_LOGGER) << "Created event: " << name << ", address: " << address;
|
//CLOG_IF(VLOG_IS_ON(0), INFO, INPUT_LOGGER) << "Created event: " << name << ", address: " << address;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Event::getJsonString()
|
std::string Event::getJsonString()
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#include "utility/config.h"
|
#include "utility/config.h"
|
||||||
|
|
||||||
#include "EventNotifier.h"
|
#include "EventNotifier.h"
|
||||||
|
|
||||||
namespace flippR_driver
|
namespace flippR_driver
|
||||||
@@ -72,10 +70,10 @@ void EventNotifier::notify()
|
|||||||
|
|
||||||
// getting a guard and calling all registered handlers
|
// getting a guard and calling all registered handlers
|
||||||
std::lock_guard<std::mutex> event_handler_guard(this->event_handler_mutex);
|
std::lock_guard<std::mutex> event_handler_guard(this->event_handler_mutex);
|
||||||
CLOG(INFO, INPUT_LOGGER) << "Notified " << this->event_handlers.size() << " EventHandlers";
|
//CLOG(INFO, INPUT_LOGGER) << "Notified " << this->event_handlers.size() << " EventHandlers";
|
||||||
for(auto handler : this->event_handlers)
|
for(auto handler : this->event_handlers)
|
||||||
{
|
{
|
||||||
CLOG(INFO, INPUT_LOGGER) << "Notify " << handler;
|
//CLOG(INFO, INPUT_LOGGER) << "Notify " << handler;
|
||||||
boost::thread handler_caller(boost::bind(&EventHandler::handle, handler, event));
|
boost::thread handler_caller(boost::bind(&EventHandler::handle, handler, event));
|
||||||
|
|
||||||
if(!handler_caller.timed_join(boost::posix_time::milliseconds(INPUT_HANDLER_TIMEOUT_MILLI)))
|
if(!handler_caller.timed_join(boost::posix_time::milliseconds(INPUT_HANDLER_TIMEOUT_MILLI)))
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Display::Display(const uint8_t & address, const uint8_t & id) :
|
|||||||
address(address),
|
address(address),
|
||||||
id(id)
|
id(id)
|
||||||
{
|
{
|
||||||
CLOG(INFO, OUTPUT_LOGGER) << "Created display with id " << id << " and address " << address << ".";
|
// CLOG(INFO, OUTPUT_LOGGER) << "Created display with id " << id << " and address " << address << ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Display::get_id() const
|
uint8_t Display::get_id() const
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace detail
|
|||||||
Flipper::Flipper(std::shared_ptr<DriverBoardPinController> pin_controller, const uint8_t & address, const uint8_t & pin_base, const std::string & name) :
|
Flipper::Flipper(std::shared_ptr<DriverBoardPinController> pin_controller, const uint8_t & address, const uint8_t & pin_base, const std::string & name) :
|
||||||
Item(std::move(name)), DriverBoardItem(pin_controller, address, pin_base), pin_controller(std::move(pin_controller))
|
Item(std::move(name)), DriverBoardItem(pin_controller, address, pin_base), pin_controller(std::move(pin_controller))
|
||||||
{
|
{
|
||||||
CLOG(INFO, OUTPUT_LOGGER) << "Created Flipper relay " << this->name << " with address " << this->address;
|
// CLOG(INFO, OUTPUT_LOGGER) << "Created Flipper relay " << this->name << " with address " << this->address;
|
||||||
}
|
}
|
||||||
|
|
||||||
Flipper::~Flipper()
|
Flipper::~Flipper()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Lamp::Lamp(std::shared_ptr<DriverBoardPinController> pin_controller, const uint8
|
|||||||
activated(false),
|
activated(false),
|
||||||
activation_time(10)
|
activation_time(10)
|
||||||
{
|
{
|
||||||
CLOG(INFO, OUTPUT_LOGGER) << "Created lamp " << name << " with address " << address;
|
// CLOG(INFO, OUTPUT_LOGGER) << "Created lamp " << name << " with address " << address;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lamp::activate()
|
void Lamp::activate()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace detail
|
|||||||
Solenoid::Solenoid(std::shared_ptr<DriverBoardPinController> pin_controller, const uint8_t & address, const uint8_t & pin_base, const std::string & name, const std::chrono::milliseconds & deactivation_time)
|
Solenoid::Solenoid(std::shared_ptr<DriverBoardPinController> pin_controller, const uint8_t & address, const uint8_t & pin_base, const std::string & name, const std::chrono::milliseconds & deactivation_time)
|
||||||
: detail::Item(std::move(name)), DriverBoardItem(pin_controller, address, pin_base), pin_controller(pin_controller), deactivation_time(deactivation_time)
|
: detail::Item(std::move(name)), DriverBoardItem(pin_controller, address, pin_base), pin_controller(pin_controller), deactivation_time(deactivation_time)
|
||||||
{
|
{
|
||||||
CLOG(INFO, OUTPUT_LOGGER) << "Created solenoid " << name << " with address " << address;
|
//CLOG(INFO, OUTPUT_LOGGER) << "Created solenoid " << name << " with address " << address;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Solenoid::triggerTask()
|
void Solenoid::triggerTask()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace detail
|
|||||||
Sound::Sound(std::shared_ptr<SoundBoardPinController> pin_controller, const uint8_t & address, const uint8_t & pin_base, const std::string & name, const std::chrono::milliseconds & deactivation_time, const u_int id)
|
Sound::Sound(std::shared_ptr<SoundBoardPinController> pin_controller, const uint8_t & address, const uint8_t & pin_base, const std::string & name, const std::chrono::milliseconds & deactivation_time, const u_int id)
|
||||||
: detail::Item(std::move(name)), DriverBoardItem(pin_controller, address, pin_base), pin_controller(std::move(pin_controller)), deactivation_time(deactivation_time), id(id)
|
: detail::Item(std::move(name)), DriverBoardItem(pin_controller, address, pin_base), pin_controller(std::move(pin_controller)), deactivation_time(deactivation_time), id(id)
|
||||||
{
|
{
|
||||||
CLOG(INFO, OUTPUT_LOGGER) << "Created sound " << id << " with name " << name << " and address " << address;
|
// CLOG(INFO, OUTPUT_LOGGER) << "Created sound " << id << " with name " << name << " and address " << address;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::play()
|
void Sound::play()
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ void digitalWrite(int pin, int value)
|
|||||||
int mcp23017Setup(const int pinBase, const int i2cAddress)
|
int mcp23017Setup(const int pinBase, const int i2cAddress)
|
||||||
{
|
{
|
||||||
//std::cout << "mcp23017Setup called with pinBase " << pinBase << " and i2cAddress " << i2cAddress << std::endl;
|
//std::cout << "mcp23017Setup called with pinBase " << pinBase << " and i2cAddress " << i2cAddress << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user