Merge branch 'master' of github.com:swinginbird/flippr-code
This commit is contained in:
@@ -56,11 +56,11 @@
|
||||
"id" : 255,
|
||||
"address" : 0,
|
||||
"name" : "Deactivation Sound"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id" : 0,
|
||||
"address" : 22,
|
||||
"name" : "Sound 1",
|
||||
"name" : "Sound 1"
|
||||
},
|
||||
{
|
||||
"id" : 1,
|
||||
@@ -151,7 +151,7 @@
|
||||
"id" : 18,
|
||||
"address" : 40,
|
||||
"name" : "Sound 19"
|
||||
},84.4932%
|
||||
},
|
||||
{
|
||||
"id" : 19,
|
||||
"address" : 41,
|
||||
|
||||
@@ -13,14 +13,8 @@ namespace output
|
||||
{
|
||||
|
||||
SoundFactory::SoundFactory(nlohmann::json &object, std::shared_ptr<SoundBoardPinController> pin_controller) :
|
||||
ItemFactory{object, pin_controller},
|
||||
deactivation_time{0}
|
||||
ItemFactory{object, pin_controller}
|
||||
{
|
||||
if (object.find(config_path::deactivation_time) != object.end())
|
||||
{
|
||||
this->deactivation_time = object.at(config_path::deactivation_time).get<uint8_t>();
|
||||
}
|
||||
|
||||
this->set_fire_pin();
|
||||
this->set_address_pins();
|
||||
}
|
||||
@@ -35,12 +29,7 @@ std::map<std::string, std::shared_ptr<items::Sound>> SoundFactory::getItemMap()
|
||||
auto address = sound.at(config_path::item_address).get<uint8_t >();
|
||||
auto id = sound.at(config_path::item_identifier).get<uint>();
|
||||
|
||||
std::chrono::milliseconds deactivation_time_chrono{this->deactivation_time};
|
||||
if (sound.find(config_path::deactivation_time) != sound.end())
|
||||
{
|
||||
deactivation_time_chrono = std::chrono::milliseconds{sound.at(config_path::deactivation_time).get<uint8_t>()};
|
||||
}
|
||||
auto sound_item = std::make_shared<items::detail::Sound>(std::static_pointer_cast<SoundBoardPinController>(this->pin_controller), address, name, deactivation_time_chrono, id);
|
||||
auto sound_item = std::make_shared<items::detail::Sound>(std::static_pointer_cast<SoundBoardPinController>(this->pin_controller), address, name, id);
|
||||
|
||||
sound_map.emplace(name, sound_item);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,6 @@ public:
|
||||
private:
|
||||
void set_fire_pin();
|
||||
void set_address_pins();
|
||||
|
||||
private:
|
||||
uint8_t deactivation_time;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user