mirror of https://github.com/arendst/Tasmota.git
Merge branch 'development' of github.com:arendst/Tasmota into pr_tm1638
This commit is contained in:
commit
2ea5831d9e
|
@ -411,17 +411,17 @@ void ILI9341_2::setRotation(uint8_t m) {
|
||||||
_height = iheight;
|
_height = iheight;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
m = (MADCTL_MV | MADCTL_BGR);
|
m = (MADCTL_MY | MADCTL_MV | MADCTL_BGR);
|
||||||
_width = iheight;
|
_width = iheight;
|
||||||
_height = iwidth;
|
_height = iwidth;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
m = (MADCTL_MY | MADCTL_BGR);
|
m = (MADCTL_MY | MADCTL_MX | MADCTL_BGR);
|
||||||
_width = iwidth;
|
_width = iwidth;
|
||||||
_height = iheight;
|
_height = iheight;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
|
m = (MADCTL_MX | MADCTL_MV | MADCTL_BGR);
|
||||||
_width = iheight;
|
_width = iheight;
|
||||||
_height = iwidth;
|
_height = iwidth;
|
||||||
break;
|
break;
|
||||||
|
@ -527,7 +527,7 @@ void ili9342_bpwr(uint8_t on);
|
||||||
|
|
||||||
void ILI9341_2::DisplayOnff(int8_t on) {
|
void ILI9341_2::DisplayOnff(int8_t on) {
|
||||||
|
|
||||||
if (_hwspi>=2) {
|
if ((_hwspi >= 2) && (_bp < 0)) {
|
||||||
ili9342_bpwr(on);
|
ili9342_bpwr(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,11 +537,11 @@ void ILI9341_2::DisplayOnff(int8_t on) {
|
||||||
writecmd(ILI9341_2_DISPON);
|
writecmd(ILI9341_2_DISPON);
|
||||||
ILI9341_2_CS_HIGH
|
ILI9341_2_CS_HIGH
|
||||||
SPI_END_TRANSACTION();
|
SPI_END_TRANSACTION();
|
||||||
if (_bp>=0) {
|
if (_bp >= 0) {
|
||||||
#ifdef ILI9341_2_DIMMER
|
#ifdef ILI9341_2_DIMMER
|
||||||
ledcWrite(ESP32_PWM_CHANNEL,dimmer);
|
ledcWrite(ESP32_PWM_CHANNEL, dimmer);
|
||||||
#else
|
#else
|
||||||
digitalWrite(_bp,HIGH);
|
digitalWrite(_bp, HIGH);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -550,20 +550,22 @@ void ILI9341_2::DisplayOnff(int8_t on) {
|
||||||
writecmd(ILI9341_2_DISPOFF);
|
writecmd(ILI9341_2_DISPOFF);
|
||||||
ILI9341_2_CS_HIGH
|
ILI9341_2_CS_HIGH
|
||||||
SPI_END_TRANSACTION();
|
SPI_END_TRANSACTION();
|
||||||
if (_bp>=0) {
|
if (_bp >= 0) {
|
||||||
#ifdef ILI9341_2_DIMMER
|
#ifdef ILI9341_2_DIMMER
|
||||||
ledcWrite(ESP32_PWM_CHANNEL,0);
|
ledcWrite(ESP32_PWM_CHANNEL, 0);
|
||||||
#else
|
#else
|
||||||
digitalWrite(_bp,LOW);
|
digitalWrite(_bp, LOW);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ILI9341_2::invertDisplay(boolean i) {
|
void ILI9341_2::invertDisplay(boolean i) {
|
||||||
|
SPI_BEGIN_TRANSACTION();
|
||||||
ILI9341_2_CS_LOW
|
ILI9341_2_CS_LOW
|
||||||
writecmd(i ? ILI9341_2_INVON : ILI9341_2_INVOFF);
|
writecmd(i ? ILI9341_2_INVON : ILI9341_2_INVOFF);
|
||||||
ILI9341_2_CS_HIGH
|
ILI9341_2_CS_HIGH
|
||||||
|
SPI_END_TRANSACTION();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ili9342_dimm(uint8_t dim);
|
void ili9342_dimm(uint8_t dim);
|
||||||
|
|
|
@ -406,21 +406,16 @@ void ShutterDecellerateForStop(uint8_t i)
|
||||||
case SHT_COUNTER:
|
case SHT_COUNTER:
|
||||||
int16_t missing_steps;
|
int16_t missing_steps;
|
||||||
Shutter[i].accelerator = -(ShutterGlobal.open_velocity_max / (Shutter[i].motordelay>4 ? (Shutter[i].motordelay*11)/10 : 4) );
|
Shutter[i].accelerator = -(ShutterGlobal.open_velocity_max / (Shutter[i].motordelay>4 ? (Shutter[i].motordelay*11)/10 : 4) );
|
||||||
while (Shutter[i].pwm_velocity > -2*Shutter[i].accelerator && Shutter[i].pwm_velocity > 100) {
|
while (Shutter[i].pwm_velocity > -2*Shutter[i].accelerator || (ShutterGlobal.position_mode == SHT_COUNTER && Shutter[i].pwm_velocity > 100) ) {
|
||||||
delay(50);
|
delay(50);
|
||||||
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Velocity %ld, Delta %d"), Shutter[i].pwm_velocity, Shutter[i].accelerator );
|
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Velocity %ld, Delta %d"), Shutter[i].pwm_velocity, Shutter[i].accelerator );
|
||||||
//Shutter[i].pwm_velocity = tmax(Shutter[i].pwm_velocity-Shutter[i].accelerator , 0);
|
|
||||||
// Control will be done in RTC Ticker.
|
// Control will be done in RTC Ticker.
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ShutterGlobal.position_mode == SHT_COUNTER){
|
if (ShutterGlobal.position_mode == SHT_COUNTER){
|
||||||
missing_steps = ((Shutter[i].target_position-Shutter[i].start_position)*Shutter[i].direction*ShutterGlobal.open_velocity_max/RESOLUTION/STEPS_PER_SECOND) - RtcSettings.pulse_counter[i];
|
missing_steps = ((Shutter[i].target_position-Shutter[i].start_position)*Shutter[i].direction*ShutterGlobal.open_velocity_max/RESOLUTION/STEPS_PER_SECOND) - RtcSettings.pulse_counter[i];
|
||||||
//prepare for stop PWM
|
//prepare for stop PWM
|
||||||
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Remain steps %d, Counter %d, Freq %d"), missing_steps, RtcSettings.pulse_counter[i] ,Shutter[i].pwm_velocity);
|
|
||||||
Shutter[i].accelerator = 0;
|
Shutter[i].accelerator = 0;
|
||||||
Shutter[i].pwm_velocity = Shutter[i].pwm_velocity > 250 ? 250 : Shutter[i].pwm_velocity;
|
|
||||||
analogWriteFreq(Shutter[i].pwm_velocity);
|
|
||||||
analogWrite(Pin(GPIO_PWM1, i), 50);
|
|
||||||
Shutter[i].pwm_velocity = 0;
|
Shutter[i].pwm_velocity = 0;
|
||||||
while (RtcSettings.pulse_counter[i] < (uint32_t)(Shutter[i].target_position-Shutter[i].start_position)*Shutter[i].direction*ShutterGlobal.open_velocity_max/RESOLUTION/STEPS_PER_SECOND) {
|
while (RtcSettings.pulse_counter[i] < (uint32_t)(Shutter[i].target_position-Shutter[i].start_position)*Shutter[i].direction*ShutterGlobal.open_velocity_max/RESOLUTION/STEPS_PER_SECOND) {
|
||||||
}
|
}
|
||||||
|
@ -496,7 +491,7 @@ void ShutterUpdatePosition(void)
|
||||||
Shutter[i].time, toBeAcc, current_stop_way, Shutter[i].pwm_velocity, velocity_max, Shutter[i].accelerator, min_runtime_ms, Shutter[i].real_position,
|
Shutter[i].time, toBeAcc, current_stop_way, Shutter[i].pwm_velocity, velocity_max, Shutter[i].accelerator, min_runtime_ms, Shutter[i].real_position,
|
||||||
next_possible_stop_position, Shutter[i].target_position, velocity_change_per_step_max, Shutter[i].direction);
|
next_possible_stop_position, Shutter[i].target_position, velocity_change_per_step_max, Shutter[i].direction);
|
||||||
|
|
||||||
if ( Shutter[i].real_position * Shutter[i].direction + 2*Shutter[i].pwm_velocity >= Shutter[i].target_position * Shutter[i].direction ) {
|
if ( Shutter[i].real_position * Shutter[i].direction >= Shutter[i].target_position * Shutter[i].direction || (ShutterGlobal.position_mode == SHT_COUNTER && Shutter[i].accelerator <0 && Shutter[i].pwm_velocity+Shutter[i].accelerator<=100)) {
|
||||||
if (Shutter[i].direction != 0) {
|
if (Shutter[i].direction != 0) {
|
||||||
Shutter[i].lastdirection = Shutter[i].direction;
|
Shutter[i].lastdirection = Shutter[i].direction;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ bool tft_init_done = false;
|
||||||
void ILI9341_InitDriver()
|
void ILI9341_InitDriver()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef USE_M5STACK_CORE2
|
#if (defined(USE_M5STACK_CORE2) || defined(USE_M5STACK_CORE_BASIC))
|
||||||
if (TasmotaGlobal.spi_enabled) {
|
if (TasmotaGlobal.spi_enabled) {
|
||||||
#else
|
#else
|
||||||
// There are displays without CS
|
// There are displays without CS
|
||||||
|
@ -75,6 +75,9 @@ void ILI9341_InitDriver()
|
||||||
#ifdef USE_M5STACK_CORE2
|
#ifdef USE_M5STACK_CORE2
|
||||||
// fixed pins on m5stack core2
|
// fixed pins on m5stack core2
|
||||||
ili9341_2 = new ILI9341_2(5, -2, 15, -2);
|
ili9341_2 = new ILI9341_2(5, -2, 15, -2);
|
||||||
|
#elif defined(USE_M5STACK_CORE_BASIC)
|
||||||
|
// int8_t cs, int8_t res, int8_t dc, int8_t bp)
|
||||||
|
ili9341_2 = new ILI9341_2(14, 33, 27, 32);
|
||||||
#else
|
#else
|
||||||
// check for special case with 2 SPI busses (ESP32 bitcoin)
|
// check for special case with 2 SPI busses (ESP32 bitcoin)
|
||||||
if (TasmotaGlobal.soft_spi_enabled) {
|
if (TasmotaGlobal.soft_spi_enabled) {
|
||||||
|
|
Loading…
Reference in New Issue