mirror of https://github.com/arendst/Tasmota.git
Shelly Pro better light show
This commit is contained in:
parent
c3215a9d6f
commit
da65c8798b
|
@ -49,13 +49,15 @@ void ShellyProUpdate(void) {
|
|||
// bit 3 = wifi led green
|
||||
// bit 4 = wifi led red
|
||||
// bit 5 - 7 = nc
|
||||
uint32_t val = SPro.power | SPro.ledlink;
|
||||
// OE is connected to Gnd with 470 ohm resistor R62 AND a capacitor C81 to 3V3
|
||||
// - this inhibits output of signals (also relay state) during power on for a few seconds
|
||||
uint8_t val = SPro.power | SPro.ledlink;
|
||||
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
|
||||
SPI.transfer(val); // Write 74HC595 shift register
|
||||
SPI.endTransaction();
|
||||
delayMicroseconds(2); // Wait for SPI clock to stop
|
||||
// delayMicroseconds(2); // Wait for SPI clock to stop
|
||||
digitalWrite(SPro.pin_shift595_rclk, 1); // Latch data
|
||||
delayMicroseconds(2); // Shelly 10mS
|
||||
delayMicroseconds(1); // Shelly 10mS
|
||||
digitalWrite(SPro.pin_shift595_rclk, 0);
|
||||
}
|
||||
|
||||
|
@ -76,10 +78,7 @@ void ShellyProPreInit(void) {
|
|||
// Does nothing if SPI is already initiated (by ADE7953) so no harm done
|
||||
SPI.begin(Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), -1);
|
||||
|
||||
SPro.power = TasmotaGlobal.power &3; // Restore power
|
||||
SPro.ledlink = 0x18; // Blue led on
|
||||
ShellyProUpdate();
|
||||
|
||||
SPro.ledlink = 0x18; // Blue led on - set by first call ShellyProPower()
|
||||
SPro.detected = true;
|
||||
}
|
||||
}
|
||||
|
@ -124,8 +123,13 @@ void ShellyProLedLink(void) {
|
|||
*/
|
||||
SPro.last_update = TasmotaGlobal.uptime;
|
||||
uint32_t ledlink = 0x1C; // All leds off
|
||||
if (XdrvMailbox.index) { ledlink &= 0xFB; } // Blue blinks if wifi/mqtt lost
|
||||
if (!TasmotaGlobal.global_state.wifi_down) { ledlink &= 0xF7; } // Green On
|
||||
if (XdrvMailbox.index) {
|
||||
ledlink &= 0xFB; // Blue blinks if wifi/mqtt lost
|
||||
}
|
||||
else if (!TasmotaGlobal.global_state.wifi_down) {
|
||||
ledlink &= 0xF7; // Green On
|
||||
}
|
||||
|
||||
ShellyProUpdateLedLink(ledlink);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue