mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-25 15:27:17 +00:00
Update xsns_01_counter.ino
This commit is contained in:
parent
fa4680bb61
commit
6bd4edcdae
@ -99,7 +99,11 @@ void CounterUpdate(uint8_t index)
|
|||||||
uint32_t steps = (current_cycle-last_cycle+100000)/(clockCyclesPerMicrosecond() * 10000);
|
uint32_t steps = (current_cycle-last_cycle+100000)/(clockCyclesPerMicrosecond() * 10000);
|
||||||
cycle_time = (current_cycle-last_cycle)/steps;
|
cycle_time = (current_cycle-last_cycle)/steps;
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
analogWriteCCyPeriod(Pin(GPIO_PWM1, index), 5, cycle_time );
|
pinMode(Pin(GPIO_PWM1, index), OUTPUT);
|
||||||
|
uint32_t high = (cycle_time * 5) / 1023;
|
||||||
|
uint32_t low = cycle_time - high;
|
||||||
|
// Find the first GPIO being generated by checking GCC's find-first-set (returns 1 + the bit of the first 1 in an int32_t
|
||||||
|
startWaveformClockCycles(Pin(GPIO_PWM1, index), high, low, 0, -1, 0, true);
|
||||||
#else
|
#else
|
||||||
analogWrite(Pin(GPIO_PWM1, index), 5);
|
analogWrite(Pin(GPIO_PWM1, index), 5);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user