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