Marco's Affenbox Fork

Beim Druck der 3 Tasten kommt diese Ausgabe:

TonUINO Version 2.1
created by Thorsten Voß and licensed under GNU/GPL.
Information and contribution at https://tonuino.de.

Fork by Marco Schulz
load settings from flash
Version: 2
Max Vol: 25
Min Vole: 2
Init Vol: 15
EQ: 1
Locked: 0
Sleep Timer: 0
Inverted Vol Buttons: 1
Admin Menu locked: 0
Admin Menu Pin: 1111
Saved Modifier Mode: 0
set standby timer
milis: 0
Firmware Version: 0x12 = counterfeit chip
=== mfrc522-> RxGain_avg === 
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured
Shortcut: 1
not configured

Habe eine Modifikationskarte mit Admin Menü dran gehalten, das ist die Ausgabe:

load settings from flash
Version: 2
Max Vol: 25
Min Vole: 2
Init Vol: 15
EQ: 1
Locked: 0
Sleep Timer: 0
Inverted Vol Buttons: 1
Admin Menu locked: 0
Admin Menu Pin: 1111
Saved Modifier Mode: 0
set standby timer
milis: 0
Firmware Version: 0x12 = counterfeit chip
=== mfrc522-> RxGain_avg === 
ReadCardSerial finished
Card UID 
 AA  E7  DD  58 
PICC type MIFARE 1KB
Authenticating Classic using key A...
Reading data block4...
Data on Card :  13  37  B3  47 02 00 00 01 00 00 00 00 00 00 00 00 
set modifier: 0
disable standby timer
adminMenu
voiceMenu 14 Options
1

Ich komme zwar ins Menü, kann durch die Menüpunkte zwar durchschalten, aber nicht bestätigen oder abbrechen. Als ob der Pause/Play Button ohne Funktion ist.

Ohne die Verbindung zum PC geht das Admin Menü über die Modifikationskarte an und ich kann es ganz normal steuern und auch abbrechen. Seltsam. Das Menü geht über die Buttonkombi aber nicht an. Hmm.

Der scheint Dauer gedrückt zu sein!

Der Button funktioniert aber sonst normal. Meinst du, dass es am Code liegt oder irgendwie am Button selbst?

Es muss am Button liegen. Ist er richtig angeschlossen? Öffner/Schließer?
Ist auf jeden Fall Daueraktiv. Also Hardware (oder hast du an der Software was geändert bei den Eingängen für die Buttons?).

Die Buttons sind alle gleich und normal im unbetätigten Zustand offen. Die Buttons hab ich gemäß dieses Schaltplans angeschlossen:

image

Danke für die Informationen.

Kannst du die restlichen Defines auch noch Posten? Also die, in denen die Pins Hinterlegt sind?
Eventuell ist da noch ein Fehler.

Ich kann mich erst heute Abend genauer um das Problem kümmern.

Hier der komplette Anfang des Codes mit den #define Sachen:

#include <DFMiniMp3.h>
#include <EEPROM.h>
#include <JC_Button.h>
#include <MFRC522.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <avr/sleep.h>

/*
   _____         _____ _____ _____ _____
  |_   _|___ ___|  |  |     |   | |     |
    | | | . |   |  |  |-   -| | | |  |  |
    |_| |___|_|_|_____|_____|_|___|_____|
    TonUINO Version 2.1

    created by Thorsten Voß and licensed under GNU/GPL.
    Information and contribution at https://tonuino.de.
    Fork by Marco Schulz
*/

///////// uncomment the below line to enable the function ////////////////
//#define FIVEBUTTONS
#define DEBUG
//#define DEBUG_QUEUE
#define PUSH_ON_OFF
#define STARTUP_SOUND
#define SPEAKER_SWITCH
//#define ROTARY_ENCODER
//#define ROTARY_SWITCH
#define POWER_ON_LED
//////////////////////////////////////////////////////////////////////////

#ifdef ROTARY_ENCODER
#include <TimerOne.h>
#include <ClickEncoder.h>
#endif

///////// conifguration of the input and output pin //////////////////////
#define buttonPause A0 //Default A0; Pocket A2
#define buttonUp A1 //Default A1; Pocket A0
#define buttonDown 2 //Default A2; Pocket A1
#define busyPin 4

#define shutdownPin 7 //Default 7

#define openAnalogPin A7 //Default A7

#ifdef FIVEBUTTONS
#define buttonFourPin A3
#define buttonFivePin A4
#endif

#define LONG_PRESS 1000
#define LONGER_PRESS 2000
#define LONGEST_PRESS 5000

#ifdef SPEAKER_SWITCH
#define SpeakerOnPin 8
#endif

#ifdef POWER_ON_LED
#define PowerOnLEDPin 6
#endif

#ifdef ROTARY_ENCODER
#define ROTARY_ENCODER_PIN_A 5 //Default 5; 
#define ROTARY_ENCODER_PIN_B 6 //Default 6; 
#define ROTARY_ENCODER_PIN_SUPPLY 8 //uncomment if you want to use an IO pin as supply
#endif

#ifdef ROTARY_SWITCH
#define ROTARY_SWITCH_PIN  A7
//#define ROTARY_SWITCH_SUPPLY_PIN 6
#endif
//////////////////////////////////////////////////////////////////////////

////////// NFC Gain //////////////////////////////////////////////////////
//#define NFCgain_max   // Maximale Empfindlichkeit
#define NFCgain_avg   // Mittlere Empfindlichkeit
//#define NFCgain_min   // Minimale Empfindlichkeit 
//////////////////////////////////////////////////////////////////////////

///////// conifguration of the rotary encoder ////////////////////////////
#ifdef ROTARY_ENCODER
#define ROTARY_ENCODER_STEPS 4
#endif
//////////////////////////////////////////////////////////////////////////

///////// conifguration of the rotary switch ////////////////////////////
#ifdef ROTARY_SWITCH
#define ROTARY_SWITCH_POSITIONS 12
#define ROTARY_SWITCH_TOLERNACE 0.15
#define ROTARY_SWITCH_REF_VOLTAGE 5.0
#define ROTARY_SWITCH_STEP_MIN ((ROTARY_SWITCH_REF_VOLTAGE/ROTARY_SWITCH_POSITIONS) - ((ROTARY_SWITCH_REF_VOLTAGE/ROTARY_SWITCH_POSITIONS)*ROTARY_SWITCH_TOLERNACE))
#define ROTARY_SWITCH_STEP_MAX ((ROTARY_SWITCH_REF_VOLTAGE/ROTARY_SWITCH_POSITIONS) + ((ROTARY_SWITCH_REF_VOLTAGE/ROTARY_SWITCH_POSITIONS)*ROTARY_SWITCH_TOLERNACE))
#define ROTARY_SWITCH_TRIGGER_TIME 2000
#endif
//////////////////////////////////////////////////////////////////////////

///////// MFRC522 ////////////////////////////////////////////////////////
#define RST_PIN 9                 // Configurable, see typical pin layout above
#define SS_PIN 10                 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522
MFRC522::MIFARE_Key key;
bool successRead;
byte sector = 1;
byte blockAddr = 4;
byte trailerBlock = 7;
MFRC522::StatusCode status;
//////////////////////////////////////////////////////////////////////////

///////// setup buttons //////////////////////////////////////////////////
Button pauseButton(buttonPause);
Button upButton(buttonUp);
Button downButton(buttonDown);
#ifdef FIVEBUTTONS
Button buttonFour(buttonFourPin);
Button buttonFive(buttonFivePin);
#endif
bool ignorePauseButton = false;
bool ignoreUpButton = false;
bool ignoreDownButton = false;
#ifdef FIVEBUTTONS
bool ignoreButtonFour = false;
bool ignoreButtonFive = false;
#endif
//////////////////////////////////////////////////////////////////////////

//////// rotary encoder /////////////////////////////////////////////////
#ifdef ROTARY_ENCODER
int16_t RotEncOldEncPos = -1 ;
int16_t RotEncPos = 15;
ClickEncoder encoder(ROTARY_ENCODER_PIN_A, ROTARY_ENCODER_PIN_B, ROTARY_ENCODER_STEPS);
#endif
//////////////////////////////////////////////////////////////////////////

//////// rotary encoder /////////////////////////////////////////////////
#ifdef ROTARY_SWITCH
uint8_t RotSwCurrentPos = 0;
unsigned long RotSwMillis = 0;
uint8_t RotSwNewPos = 0;
uint8_t RotSwActivePos = 0;
#endif

Ich hab dann noch die Standardwerte für die Lautstärke direkt in der Firmware angepasst und die Zeit für PUSH_ON_OFF über den Play Button auf 5 Sekunden gesetzt. Mehr hab ich nicht gemacht.

Okay ich denke ich habs, das war mein Fehler.

#define buttonDown sollte A2 heißen, nicht nur 2.

Das war bekannt, habs aber vergessen zu ändern.

Ja cool, ich teste das heute Abend, wenn mein Kleiner schlafen ist :wink:

Ich hab es im Repo korrigiert.

@marco-117 Hab die neueste Version getestet. Das Admin Menü läuft nun einwandfrei. Allerding ist da wohl noch ein Wurm drin bei der nextTrack Methode. Diese scheint nicht richtig den nächsten Titel zu schalten. Hier die Ausgabe bei Druck auf nächsten Track (drei mal gedrückt):

TonUINO Version 2.1
created by Thorsten Voß and licensed under GNU/GPL.
Information and contribution at https://tonuino.de.

Fork by Marco Schulz
load settings from flash
Version: 2
Max Vol: 30
Min Vole: 2
Init Vol: 15
EQ: 1
Locked: 0
Sleep Timer: 5
Inverted Vol Buttons: 0
Admin Menu locked: 0
Admin Menu Pin: 1111
Saved Modifier Mode: 0
set standby timer
milis: 302136
Firmware Version: 0x12 = counterfeit chip
=== mfrc522-> RxGain_avg === 
ReadCardSerial finished
Card UID 
 F0  94  D0  59 
PICC type MIFARE 1KB
Authenticating Classic using key A...
Reading data block4...
Data on Card :  13  37  B3  47 02 02 05 00 00 00 00 00 00 00 00 00 
2
2
new card
playFolder
disable standby timer
30 tracks in folder 2
Audio Book
read memory No. 0 of folder No. 2
play track: 9
write track No. 10 of folder No. 2 in memory No. 0
set standby timer
milis: 311426
write track No. 11 of folder No. 2 in memory No. 0
set standby timer
milis: 317249
write track No. 12 of folder No. 2 in memory No. 0
set standby timer
milis: 319463

Der DFPlayer leuchtet zwar blau, zu hören ist aber nichts. Die Karte muss erstmal entfernt werden und wieder aufgelegt werden, dann ist wieder was zu hören. Danach gibt es gar keine Reaktion bei Druck der Next Taste. Der vorherige Track wird normal geschaltet.

Gruß

Ist das neu auflegen der Karte auch in der Konsolen Ausgabe zu sehen?

Da sieht alles normal aus.

Die Karte soll ein Hörbuch sein? Und das hast du schon bis Track neun gehört?

Verwendet du andere Modi? Laufen die?

Das erneute Auflegen der Karte ist in der Konsole zu sehen. Habe den Modus der Karte per App auf Album umgestellt und folgendes durchgeführt.

  • Karte Auflegen > Track 1 wird gespielt
  • Karte Entfernen > Track stoppt
  • Karte erneut Auflegen > Track 1 wird fortgesetzt
  • Next Track > keine Reaktion und Track 1 wird einfach weitergespielt (keine Ausgabe in der Konsole)
  • Vorheriger Track (2x) > Track 1 beginnt von vorne
  • Karte Entfernen > Wiedergabe wird gestoppt

Hier die entsprechende Konsolenausgabe:

TonUINO Version 2.1
created by Thorsten Voß and licensed under GNU/GPL.
Information and contribution at https://tonuino.de.

Fork by Marco Schulz
load settings from flash
Version: 2
Max Vol: 30
Min Vole: 2
Init Vol: 15
EQ: 1
Locked: 0
Sleep Timer: 5
Inverted Vol Buttons: 0
Admin Menu locked: 0
Admin Menu Pin: 1111
Saved Modifier Mode: 0
set standby timer
milis: 302136
Firmware Version: 0x12 = counterfeit chip
=== mfrc522-> RxGain_avg === 
ReadCardSerial finished
Card UID 
 F0  94  D0  59 
PICC type MIFARE 1KB
Authenticating Classic using key A...
Reading data block4...
Data on Card :  13  37  B3  47 02 02 02 00 00 00 00 00 00 00 00 00 
2
2
new card
playFolder
disable standby timer
30 tracks in folder 2
Album
play track: 1
card gone
set standby timer
milis: 312062
ReadCardSerial finished
Card UID 
 F0  94  D0  59 
PICC type MIFARE 1KB
Authenticating Classic using key A...
Reading data block4...
Data on Card :  13  37  B3  47 02 02 02 00 00 00 00 00 00 00 00 00 
2
2
same card
disable standby timer
card gone
set standby timer
milis: 325929
ReadCardSerial finished
Card UID 
 F0  94  D0  59 
PICC type MIFARE 1KB
Authenticating Classic using key A...
Reading data block4...
Data on Card :  13  37  B3  47 02 02 02 00 00 00 00 00 00 00 00 00 
2
2
same card
disable standby timer
previous track: 1
previous track: 1
card gone
set standby timer
milis: 341913

Hmm… ich bin da etwas überfragt, was da los ist.

Okay Danke, dass hilft mir sehr weiter, dann weiß ich an welcher stelle der Fehler liegen sollte.

Die einzige Fehlfunktion ist somit das manuelle Track zurück und weiter?

Ich denke die Fehlfunktion ist nur bei Track weiter. Track zurück wurde ausgeführt.

Hab den Fehler gefunden. Beim letzten Fix habich mir direkt einen neuen Bug eingebaut.

Dia Aktualisierte Version ist hochgeladen

Das weiterspringen läuft jetzt, leider nur solange die Karte drauf bleibt. Nimmt man die Karte einmal weg und legt Sie wieder auf, kann man wieder nicht weiterspringen. Zurück zum vorherigen Track geht aber immer.

Gruß

Okay, das muss ich mur dann nochmal anschauen.
War gestern spät hab nur einen schnellen test gemacht