mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 13:16:32 +00:00
Update esp8266toEsp32.cpp
This commit is contained in:
parent
c1fba57bb6
commit
51472ef842
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@ -70,16 +69,16 @@ int32_t _analog_pin2chan(uint32_t pin) { // returns -1 if uallocated
|
|||||||
|
|
||||||
void _analogWriteFreqRange(uint8_t pin) {
|
void _analogWriteFreqRange(uint8_t pin) {
|
||||||
_analogInit(); // make sure the mapping array is initialized
|
_analogInit(); // make sure the mapping array is initialized
|
||||||
if (pin = 255) {
|
if (pin == 255) {
|
||||||
for (uint32_t channel = 0; channel < MAX_PWMS; channel++) {
|
for (uint32_t channel = 0; channel < MAX_PWMS; channel++) {
|
||||||
if (pwm_channel[channel] < 255) {
|
if (pwm_channel[channel] < 255) {
|
||||||
ledcSetup(channel, pwm_frequency, pwm_bit_num);
|
ledcSetup(channel, pwm_frequency, pwm_bit_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int32_t chan = _analog_pin2chan(pin);
|
int32_t channel = _analog_pin2chan(pin);
|
||||||
if (chan >= 0) {
|
if (channel >= 0) {
|
||||||
ledcSetup(chan, pwm_frequency, pwm_bit_num);
|
ledcSetup(channel, pwm_frequency, pwm_bit_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,7 +139,6 @@ int32_t analogAttach(uint32_t pin, bool output_invert) { // returns ledc chan
|
|||||||
};
|
};
|
||||||
ledc_channel_config(&ledc_channel);
|
ledc_channel_config(&ledc_channel);
|
||||||
|
|
||||||
|
|
||||||
ledcSetup(channel, pwm_frequency, pwm_bit_num);
|
ledcSetup(channel, pwm_frequency, pwm_bit_num);
|
||||||
// Serial.printf("PWM: New attach pin %d to channel %d\n", pin, channel);
|
// Serial.printf("PWM: New attach pin %d to channel %d\n", pin, channel);
|
||||||
return channel;
|
return channel;
|
||||||
@ -165,7 +163,6 @@ extern "C" void __wrap__Z11analogWritehi(uint8_t pin, int val) {
|
|||||||
By default all phases are starting at the same moment. This means
|
By default all phases are starting at the same moment. This means
|
||||||
the the power supply always takes a power hit at the start of each
|
the the power supply always takes a power hit at the start of each
|
||||||
new cycle, even if the average power is low.
|
new cycle, even if the average power is low.
|
||||||
|
|
||||||
Phase control is also of major importance for H-bridge where
|
Phase control is also of major importance for H-bridge where
|
||||||
both PWM lines should NEVER be active at the same time.
|
both PWM lines should NEVER be active at the same time.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user