jczic / KT403A-MP3

MicroPython driver for KT403A MP3 chip (DFPlayer, GroveMP3, ... used on Pycom modules)
https://www.hc2.fr/lab
11 stars 11 forks source link

GetCurrentTrack and GetTracksCount returned value in 8bit (0-255) high byte is always 0 #3

Open drrokko opened 1 year ago

drrokko commented 1 year ago

seems this is an hardware issue.

i coded this to cheat this issue:

  def getRealFilesCount(self):
    c = 0
    if self.getState() > 0:
      return None
    vol_bkup = self._vol
    self.volume(0)
    sleep_ms(100)
    a = self.getFilesCount()
    sleep_ms(100)
    while True:
      b = c * 256 + a + 1
      self.play(b)
      sleep_ms(900)
      d = self.getCurrentTrack()
      sleep_ms(100)
      #print('loop', a, b, c, d)
      if d == a:
        self.stop()
        sleep_ms(100)
        self.volume(vol_bkup)
        return c * 256 + a
      c += 1
    self.volume(vol_bkup)

greetings from germany

jczic commented 1 year ago

Hi @drrokko and thanks for your feedback, your chip is KT403A-MP3 ? I didn't see this bug, in fact it doesn't work anymore after 255 files is it right? I'm not really into it at the moment but it must be possible to make a simple patch to correctly calculate the right number without all this code no? Please tell me more.

Greetings from France :)