MrYsLab / s3-extend

Control an Arduino Uno, Circuit Playground Express, Raspberry Pi Pico, ESP-8266, ESP-32, Picoboard, Robohat MM1, or Rasberry Pi From Scratch 3
GNU Affero General Public License v3.0
27 stars 13 forks source link

a bug of .../s3_extend/gateways/rpi_gateway.py #29

Closed KigenHasebe closed 2 years ago

KigenHasebe commented 2 years ago

Hey,

I think the following code has a bug which halves the real tone frequency.

class RpiGateway(GatewayBase): ... def play_tone(self, topic, payload): ... frequency = int(payload['freq']) frequency = int((1000 / frequency) * 1000) tone = [pigpio.pulse(1 << pin, 0, frequency), pigpio.pulse(0, 1 << pin, frequency)]

That is, the second line of the code should be:

    frequency = int((1000 / frequency) * 1000 / 2)

Bye.

MrYsLab commented 2 years ago

Fixed with release 1.16