871
Le logiciel DCC++ / Re : DCC++ BaseStation
« le: août 30, 2016, 08:59:06 am »
Bonjour Denis,
Non pas en roulant, c'est ce que disait Dominique.
Par contre, il s'est "fabriqué" une méthode :
"r" dans commandString[0] = 'r'; est créé ad hoc (n'existe pas à l'origine) qu'il "parse" avec une méthode pour la voie principale (qui est similaire à la méthode pour la voie de programmation)
On voit case 'r' au début et mRegs-> en fin (pour la voie principale)
Le tout appelé dans le setup pour faire apparître l'adresse dans le moniteur série :
Voilà.
Christophe
Non pas en roulant, c'est ce que disait Dominique.
Par contre, il s'est "fabriqué" une méthode :
Code: [Sélectionner]
void SerialCommand::discover() {
commandString[0] = '1';
parse(commandString);
commandString[0] = 'r';
commandString[1] = ' ';
commandString[2] = '1';
commandString[3] = ' ';
commandString[4] = '1';
commandString[5] = '2';
commandString[6] = '3';
commandString[7] = ' ';
commandString[8] = '1';
commandString[9] = '2';
commandString[10] = '3';
parse(commandString);
commandString[0] = '0';
parse(commandString);
}
"r" dans commandString[0] = 'r'; est créé ad hoc (n'existe pas à l'origine) qu'il "parse" avec une méthode pour la voie principale (qui est similaire à la méthode pour la voie de programmation)
Code: [Sélectionner]
case 'r': // <r CV CALLBACKNUM CALLBACKSUB>
/*
* reads a Configuration Variable from the decoder of an engine on the main track
*
* CV: the number of the Configuration Variable memory location in the decoder to read from (1-1024)
* CALLBACKNUM: an arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs that call this function
* CALLBACKSUB: a second arbitrary integer (0-32767) that is ignored by the Base Station and is simply echoed back in the output - useful for external programs (e.g. DCC++ Interface) that call this function
*
* returns: <r CALLBACKNUM|CALLBACKSUB|CV VALUE)
* where VALUE is a number from 0-255 as read from the requested CV, or -1 if read could not be verified
*/
mRegs->readCV_Main(com+1);
break;
On voit case 'r' au début et mRegs-> en fin (pour la voie principale)
Le tout appelé dans le setup pour faire apparître l'adresse dans le moniteur série :
Code: [Sélectionner]
mainRegs.addressDccToDiscover = 3;
SerialCommand::discover(); // dcc adress found is stored in readCV_Main()
Serial.println();
Serial.print("adresse DCC : ");Serial.println(mainRegs.addressDccToDiscover);
Voilà.
Christophe