-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creeping line on the screen HU #26
Comments
Awesome! Thanks for the kind words. Do you do the scrolling by updating the text very often or did you find a nicer way? |
I can’t defeat the melbus, but I can insert such a piece into your code |
Great, good work! |
Hi |
Hi. Can I post your code here with my improvements? |
Hi. In addition to the code, you must have a shield bluetooth with Rx/Tx |
Yes |
Here is the text for my "tandem" Todo (someone): if possible, enable scrolling text. This should be possible since the text messages is larger than the screen.
By Thomas Landahl, 2018-10-16 Comm sniffing and some code contribution by Vincent Gijsen. Thanks a LOT! */ #include <EEPROM.h> #define INT_NUM (byte)1 //Interrupt number (0/1 on ATMega 328P) /*const byte mutePin = 9; const byte LED_RED_LFT = 14; //A0 byte track = 0x01; //Display show HEX value, not DEC. (A-F not "allowed") //volatile variables used inside AND outside of ISP byte byteToSend = 0; //global to avoid unnecessary overhead #define RESPONSE_ID 0xC5 //ID while responding to init requests (which will use base_id) #define CDC_RESPONSE_ID 0xEE //ID while responding to init requests (which will use base_id) byte textHeader[] = {0xFC, 0xC6, 0x73, 0x01}; //HU asks for line 3 and 4 below at startup. They can be overwritten by customText if you change textRow to 3 or 4 const byte C1_Init_1[9] = { const byte C1_Init_2[11] = { const byte C2_Init_1[] = { const byte C3_Init_0[30] = { const byte C3_Init_1[30] = { const byte C3_Init_2[30] = { //Defining the commands. First byte is the length of the command. #define C1_1 {5, 0xC1, 0x1B, 0x7F, 0x01, 0x08} //Respond with c1_init_1 #define C2_0 {4, 0xC2, 0x1D, 0x73, 0x00} //Get next byte (nn) and respond with 10, 0, nn, 0,0 and 14 * 0x20 (possibly text) #define C3_0 {4, 0xC3, 0x1F, 0x7C, 0x00} //Respond with c1_init_2 (text) #define C5_1 {3, 0xC5, 0x19, 0x73} //C5, 19, 73, xx, yy. Answer 0x10, xx, yy + free text. End with 00 00 and pad with spaces #define CMD_1 {3, 0xC0, 0x1B, 0x76} //Followed by: [00, 92, FF], OR [01, 03 ,FF] OR [02, 05, FF]. Answer 0x10 #define BTN {4, 0xC0, 0x1D, 0x77, 0x81} //Read next byte which is the button #. Respond with 3 bytes #define CDC_CIR {3, CDC_BASE_ID, 0x1E, 0xEF} //Cartridge info request. Respond with 6 bytes //This list can be quite long. We have approx 700 us between the received bytes. const byte listLen = 34; //how many rows in the above array // some CDC (CD-CHANGER) data String input_string = ""; /*
*/ void setup() { //All lines are idle HIGH //Initiate serial communication to debug via serial-usb (arduino) // recall(); //get stored states from EEPROM and output to the LED driver. //Activate interrupt on clock pin //Call function that tells HU that we want to register a new device /* **************************************************
*/ void loop() { //these variables are reset every loop HWTicks++; //check BUSY line active (active low)
} //Do other stuff here if you want. MELBUS lines are free now. BUSY = IDLE (HIGH) //Printing transmission log (from HU, excluding our answer and things after it) //runOnce is counting down to zero and stays there //check if BUSY-line is alive //check if we are receiving any data //check if HU is talking to us specifically, otherwise force it. //Reset stuff
} //initiate MRB2 to send text (from one of the four textlines in customText[textRow][]) if (runPeriodically == 0) {
} /* // текст со значениями 16 системы в десятичное число
} // номер телефона //завершение звонка // воспроизведение БТ // воспроизведение с USB // воспроизведение с TF } void setCustomText() { void infoTrack() { Serial.println("AT+MF"); // Wait until Busy-line goes high (not busy) before we pull BUSY low to request init pinMode(MELBUS_BUSY, OUTPUT); digitalWrite(MELBUS_BUSY, HIGH); //This is a function that sends a byte to the HU - (not using interrupts) //Convert datapin to output //For each bit in the byte //We have triggered the interrupt but we don't want to read any bits, so clear the flag //This method generates our own clock. Used when in master mode. //Global external interrupt that triggers when clock pin goes high after it has been low for a short time => time to read datapin //if all the bits in the byte are read:
} void SendText(byte rowNum) { //Convert datapin and clockpin to output //send header //send which row to show it on //send text DDRD &= ~(1 << MELBUS_CLOCKBIT);//back to input (PULLUP since we clocked in the last bit with clk = high) //Clear INT flag for (byte b = 0; b < 36; b++) { } void reqMaster() { String ststxt = colors[rgtClr]; void cycleLeft() { String ststxt = colors[lftClr]; void toggleOutput(byte pinNumber) { byte pins = PINC & 0x3F; //reset customText (global variable to send to the HU) //Simulate button presses on the BT module. 200 ms works good. Less is not more in this case... void prevTrack() { void play() { //remember the state of the LEDs } void changeCD() { void SendTrackInfo() { void SendCartridgeInfo() { float getBatV() { a = analogRead(BATTERY) * 5.0 / 1023.0; //Happy listening AND READING, hacker!` |
Which BT module was used for this? |
BT201 |
Thanks to the author for the wonderful code with which we can connect BT to our devices. I came across BT that displays track data in the serial port. Here is a little finalized. https://youtu.be/w6zfiRrXcH0
Thanks!
The text was updated successfully, but these errors were encountered: