7#include "cueos_config.h"
8#if cueOS_CONFIG_NODETYPE == cueOS_NODETYPE_SLAVE_DMX
12#include "DMX512_driver.h"
13#include "DMX512_scene.h"
29static int16_t _DMX512_scene_search(
DMX512_scene_s *scene, uint16_t fixture_id){
49 if(time < scene->fadein_time){
50 value = floor(((
float)value/(
float)scene->
fadein_time)*((
float)(time)));
70 if(time < scene->fadeout_time){
71 value = floor(((
float)value/(
float)scene->
fadein_time)*((
float)(time + value)));
118 }
else if(_DMX512_scene_search(scene, fixture_preset.
fixture->
id) >= 0){
140 int16_t index = _DMX512_scene_search(scene,
id);
164 int16_t index = _DMX512_scene_search(scene,
id);
199 switch(scene->
state){
DMX512_engine_err_e
DMX512 engine error index constants.
@ DMX512_ENGINE_INSTANCE_UNDEFINED
@ DMX512_ENGINE_INSTANCE_DUPLICATE
@ DMX512_ENGINE_INSTANCE_INVALID
DMX512_driver_err_e DMX512_driver_set_single(uint16_t address, uint8_t value)
Sets a buffer's address to a given value.
void DMX512_fixture_preset_free(DMX512_fixture_preset_s *fixture_preset)
Frees a fixture preset's dynamically allocated ressources and resets its values parameters to default...
@ DMX512_FIXTURE_PRESET_UNINITIALISED
void DMX512_scene_manage(DMX512_scene_s *scene)
State machine to manage scene at a given state.
void DMX512_scene_stop(DMX512_scene_s *scene)
Starts a scene fade-out process.
DMX512_fixture_preset_s * DMX512_scene_get_fixture_preset(DMX512_scene_s *scene, uint16_t id)
Gets a fixture instance from the pool.
DMX512_scene_s DMX512_scene_new(uint16_t id, uint16_t fadein_time, uint16_t fadeout_time)
Creates and initialises a new scene instance.
#define DMX512_SCENE_DEFAULT
scene instance default values
DMX512_engine_err_e DMX512_scene_add_fixture_preset(DMX512_scene_s *scene, DMX512_fixture_preset_s fixture_preset)
Adds a fixture preset instance into the scene.
DMX512_engine_err_e DMX512_scene_del_fixture_preset(DMX512_scene_s *scene, uint16_t id)
Deletes a fixture preset instance from the scene.
void DMX512_scene_start(DMX512_scene_s *scene)
Starts a scene fade-in process.
void DMX512_scene_free(DMX512_scene_s *scene)
Resets a scene to its uninitialised state. frees dynamically allocated scene Data.
@ DMX512_SCENE_UNINITIALISED
@ DMX512_SCENE_INITIALISED
void ms_chronometer_reset(ms_chronometer_s *ms_chronometer)
Resets an mschronometer instance time delta to zero.
uint32_t ms_chronometer_get_elapsed_ms(ms_chronometer_s *ms_chronometer)
Returns elapsed time in milliseconds since last reset.
DMX512 fixture preset structure object.
DMX512_fixture_preset_status status
DMX512_fixture_s * fixture
DMX512 fixture structure object.
DMX512 scene structure object.
ms_chronometer_s ms_chronometer
DMX512_fixture_preset_s * fixture_presets
DMX512_scene_state_e state
DMX512_scene_status_e status
uint16_t fixture_preset_count