Custom Event System
Hi,
playing around with Custom Event System i got a "special" Point.
As i´m initializing additional Hardware for example some I2C stuff i also want to start UI Actions.
(let´s say similar the UI Slow Keys also lets say function called "checkI2C(int &action)" returning UIAction)
Initialising, reading etc works perfect , also executing non UI Actions via "GCode::executeFString " works great.
(i placed my function in Timer500ms) but this way i cannot use UI actions
is there a way to do it in Custom events without a modification of UIDisplay::slowAction
( i added checkI2C(nextaction) similar the original slow keys) in this case i can use the uiactionsand the others without my function in timer500 ms)?
playing around with Custom Event System i got a "special" Point.
As i´m initializing additional Hardware for example some I2C stuff i also want to start UI Actions.
(let´s say similar the UI Slow Keys also lets say function called "checkI2C(int &action)" returning UIAction)
Initialising, reading etc works perfect , also executing non UI Actions via "GCode::executeFString " works great.
(i placed my function in Timer500ms) but this way i cannot use UI actions
is there a way to do it in Custom events without a modification of UIDisplay::slowAction
( i added checkI2C(nextaction) similar the original slow keys) in this case i can use the uiactionsand the others without my function in timer500 ms)?
Comments
#ifdef CustomUI
check_Custom_Action(nextAction);
#endif
to UIDisplay::slowAction and the matching defines
(# define CustomUI ,extern int check_Custom_Action(int &nextAction) etc) to Custom events ?
what do you think about that?
I´m not shure if i understand correctly.
Got it working in Timer500ms as follows:
->my function reads from I2C device and returns UIAction
->to prevent from hangup i ping watchdog
->afterwards i call UI_Execute with that function.
so i can make it work. but nor shure if that´s a good way to do it
As i´m using I2C components i prefer inserting in slow_action, but basically it´s the same
would be great if you can do that
Thanks!
i want to implement some external PWM´s , therefore i ordered this:
https://www.adafruit.com/product/815
benefit would be free running pwm without need for timers :-)
so it would be easy to make laser drivers, spindle control etc.
i also think about fan control , as it´s a mess to combine different sizes of fans on a single control pin.
especially on low speed´s the bigger ones work, the smaller ones don´t so there would be a nice gimmick
to have additional pwms without computation load.
I´m also planning a sort of analog controlled laser diode driver controlled by external I2C DAC (might be easier to change reference voltage)
Lots of ideas but unfortunately not enough time so i think i´ll never finish :-)
in UIDisplay::fast Action()
are both events ,
EVENT_CHECK_SLOW_KEYS(nextAction); (wonder why, typo or wanted?)
EVENT_CHECK_FAST_KEYS(nextAction);
in UIDisplay::fast Action()
are both events , so why checking for slow keys in fast action?
Checked it out and works fine, so i saw you indicated some Action Nubers as "reserved"
// 1500-1699 reserved for custom Actionsso i think we should reserve some numbers for repeatable Actions also(Number range below 1000) for use in Custom Events.
so may be from 750 to 900 to leave space to others ?
is it something like :
#undef EVENT_INITALIZE_LASER
#define EVENT_INITALIZE_LASER { "my initialisation" ; return false;}
#undef EVENT_SET_LASER(intensity)
#define EVENT_SET_LASER(intensity) {" myroutine(intensity)";return false;}
#define EVENT_SET_LASER(intensity) mySetLaser(intensity)
would it be a problem for you to change intensity from uint8_t to uint16_t ?
(i´m playing with 12bit external PWM controller ,looks quite nice :-) )
so i´ll shift spindle control also to Custom event system with external hardware .
for first tests with a led and oscilloscope it looks quite nice , PWM frequency is at 900Hz which should give smooth operation.
so in the moment there are 23 channels free..., big (sense free) playground
just want to see if i get some visible changes as soon as i receive my 5 Watt Laser
ok,got it , missed the public uint8 secondspeeed , first just saw the one in queuenonlinearmove