mirror of https://github.com/arendst/Tasmota.git
Rotary experiments
This commit is contained in:
parent
767eba7e8c
commit
618d86078c
|
@ -27,15 +27,15 @@
|
|||
//#define ROTARY_OPTION2
|
||||
|
||||
#ifdef ROTARY_OPTION1
|
||||
const uint8_t rotary_dimmer_increment = 1;
|
||||
const uint8_t rotary_ct_increment = 2;
|
||||
const uint8_t rotary_color_increment = 4;
|
||||
const int8_t rotary_dimmer_increment = 1;
|
||||
const int8_t rotary_ct_increment = 2;
|
||||
const int8_t rotary_color_increment = 4;
|
||||
#endif
|
||||
|
||||
#ifdef ROTARY_OPTION2
|
||||
const uint8_t rotary_dimmer_increment = 2;
|
||||
const uint8_t rotary_ct_increment = 8;
|
||||
const uint8_t rotary_color_increment = 8;
|
||||
const int8_t rotary_dimmer_increment = 2;
|
||||
const int8_t rotary_ct_increment = 8;
|
||||
const int8_t rotary_color_increment = 8;
|
||||
#endif
|
||||
|
||||
struct ROTARY {
|
||||
|
@ -131,7 +131,7 @@ void RotaryHandler(void) {
|
|||
|
||||
Rotary.busy = true;
|
||||
|
||||
int rotary_position = Rotary.position - Rotary.last_position;
|
||||
int8_t rotary_position = Rotary.position - Rotary.last_position;
|
||||
Rotary.last_position = 128;
|
||||
Rotary.position = 128;
|
||||
|
||||
|
@ -140,13 +140,13 @@ void RotaryHandler(void) {
|
|||
}
|
||||
|
||||
if (Button.hold_timer[0]) { // Button1 is pressed: set color temperature
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: CT/Color position %d"), rotary_position);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: CT/Color position %d"), rotary_position);
|
||||
Rotary.changed = 1;
|
||||
if (!LightColorTempOffset(rotary_position * rotary_ct_increment)) { // Ct 153..500 = (500 - 153) / 8 = 43 steps
|
||||
LightColorOffset(rotary_position * rotary_color_increment); // Hue 0..359 = 360 / 8 = 45 steps
|
||||
}
|
||||
} else {
|
||||
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: Dimmer position %d"), rotary_position);
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: Dimmer position %d"), rotary_position);
|
||||
LightDimmerOffset(rotary_position * rotary_dimmer_increment); // Dimmer 1..100 = 100 / 2 = 50 steps
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue