Merge branch 'master' of github.com:swinginbird/flippr-code

This commit is contained in:
Jonas Zeunert
2020-01-15 18:04:41 +01:00
3 changed files with 5 additions and 11 deletions

View File

@@ -26,10 +26,8 @@ std::map<std::string, std::shared_ptr<items::Flipper>> FlipperFactory::getItemMa
{
auto name = flipper.at(config_path::item_name).get<std::string>();
auto address = flipper.at(config_path::item_address).get<uint8_t >();
auto extender = flipper.at(config_path::item_extender).get<std::string>();
auto pin_base = this->get_extender_pin_base(extender);
auto flipper_item = std::make_shared<items::detail::Flipper>(std::static_pointer_cast<DriverBoardPinController>(this->pin_controller), address + pin_base, name);
auto flipper_item = std::make_shared<items::detail::Flipper>(std::static_pointer_cast<DriverBoardPinController>(this->pin_controller), address, name);
flipper_map.emplace(name, flipper_item);
}
return flipper_map;

View File

@@ -19,7 +19,7 @@ LampFactory::LampFactory(nlohmann::json &object, std::shared_ptr<DriverBoardPinC
ItemFactory{object, pin_controller}
{
this->set_address_pins();
/* this->set_mux_pins();
this->set_mux_pins();
auto controller = std::dynamic_pointer_cast<detail::DriverBoardPinController>(this->pin_controller);
@@ -27,7 +27,7 @@ LampFactory::LampFactory(nlohmann::json &object, std::shared_ptr<DriverBoardPinC
controller->set_data_pin(data_pin);
auto run_pin = this->get_address_pin(this->object.at(config_path::run_pin));
controller->set_run_pin(run_pin);*/
controller->set_run_pin(run_pin);
}
std::map<std::string, std::shared_ptr<items::Lamp>> LampFactory::getItemMap()
@@ -38,10 +38,8 @@ std::map<std::string, std::shared_ptr<items::Lamp>> LampFactory::getItemMap()
{
auto name = lamp.at(config_path::item_name).get<std::string>();
auto address = lamp.at(config_path::item_address).get<uint8_t >();
auto extender = lamp.at(config_path::item_extender).get<std::string>();
auto pin_base = this->get_extender_pin_base(extender);
auto lamp_item = std::make_shared<items::detail::Lamp>(std::static_pointer_cast<DriverBoardPinController>(this->pin_controller), address + pin_base, name);
auto lamp_item = std::make_shared<items::detail::Lamp>(std::static_pointer_cast<DriverBoardPinController>(this->pin_controller), address, name);
lamp_map.emplace(name, lamp_item);
}
return lamp_map;

View File

@@ -31,8 +31,6 @@ std::map<std::string, std::shared_ptr<items::Solenoid>> SolenoidFactory::getItem
{
auto name = solenoid.at(config_path::item_name).get<std::string>();
auto address = solenoid.at(config_path::item_address).get<uint8_t >();
auto extender = solenoid.at(config_path::item_extender).get<std::string>();
auto pin_base = this->get_extender_pin_base(extender);
std::chrono::milliseconds deactivation_time_chrono{this->deactivation_time};
if (solenoid.find(config_path::deactivation_time) != solenoid.end())
@@ -40,7 +38,7 @@ std::map<std::string, std::shared_ptr<items::Solenoid>> SolenoidFactory::getItem
deactivation_time_chrono = std::chrono::milliseconds{solenoid.at(config_path::deactivation_time).get<uint8_t>()};
}
auto solenoid_item = std::make_shared<items::detail::Solenoid>(std::static_pointer_cast<DriverBoardPinController>(this->pin_controller), address + pin_base, name, deactivation_time_chrono);
auto solenoid_item = std::make_shared<items::detail::Solenoid>(std::static_pointer_cast<DriverBoardPinController>(this->pin_controller), address, name, deactivation_time_chrono);
solenoid_map.emplace(name, solenoid_item);
}
return solenoid_map;