diff --git a/esp32/mods/pybdac.c b/esp32/mods/pybdac.c index ee664d0330..7f454b57b0 100644 --- a/esp32/mods/pybdac.c +++ b/esp32/mods/pybdac.c @@ -176,10 +176,16 @@ STATIC mp_obj_t dac_tone(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a tone+=125; pyb_dac_obj[0].tone_step = (tone *(1<<16)) / 8000000 - 1; - } - else { + } else { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "DAC tone frequency out of range")); } + uint16_t tone_scale = args[1].u_int; + if (tone_scale >= 0 && tone_scale <= 3) { + self->tone_scale = tone_scale; + + } else { + nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "DAC tone scale out of range")); + } self->tone = true; self->dc_value = 0; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy