Skip to content
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

BSI crash after few minutes #34

Open
bronisMateusz opened this issue Jan 6, 2024 · 55 comments
Open

BSI crash after few minutes #34

bronisMateusz opened this issue Jan 6, 2024 · 55 comments

Comments

@bronisMateusz
Copy link

Hello,

I am still struggling with the configuration of the whole project in my Peugeot 206 RC and code from main branch.

I replaced the display from color to monochrome (I wanted BT support, and the color one didn't offer it without an additional module). Before that, I didn't have a chance to test the project longer, because I was waiting for this display.

Today I managed to do it and unfortunately I still have problems with the BSI. After a few minutes of running the kit, the BSI stops working, the main gauges start flashing.

Display number: 9803399680
IMG_5648

When everything is connected, some of the options from the display are unavailable:
087AFED7-AC55-4880-A914-EDC0D61130F6_1_105_c
(I don't know if it should be possible to do this, but you can't highlight that first icon.)
300E6A35-0411-4588-BF59-46AEA2924E14_1_105_c
AACF1F7C-6DCD-4476-9EAF-0FD825A86591_1_105_c

In the settings of the board I have: C3 - activated, C11 - activated, S1 - RD45, S2 - CAN2004, E2 - 60

@morcibacsi
Copy link
Owner

Finding a color display with Bluetooth and USB support is almost impossible. It requires a very high version number. Sw revision above 60 (6x.xxx or something like that). Maybe the ref number 9667027580 is good, but this isn't 100% accurate info.

The first icon is only available when the radio is turned on as I remember.

The "Define the vehicle parameters" is always disabled as there is nothing you could set up on a car with a VAN bus (there would be settings to enable DRL, parking assistant, follow me home light and stuff like that, but those aren't available on older cars). So even if I'd enable the menu, it wouldn't do much.

The "Manage the telephone call" is only active during a phone call as I remember.

Regarding the BSI crash you can try enabling C1 so my board won't write anything to the VAN bus. Did you remove the original display? If you enable C1 and you don't have the original display the consumption info and the door status won't work, that is perfectly normal. So try enabling C1 and reconnect the original display, and check if the BSI still crashes.

@bronisMateusz
Copy link
Author

Thank you so much for explaining everything. Actually leaving the old display in the 206 and enabling the C1 option solves all the problems. I did some miles today and there were no problems.

@morcibacsi
Copy link
Owner

Thanks for the feedback. I would like to fix this issue, and I would be glad if you could help me as I can't reproduce this issue on my car. Please capture some VAN bus logs for me if possible with the original display attached, and driving around for a few minutes. If you need further instructions I am happy to provide.

@bronisMateusz
Copy link
Author

Sure, I will try to register something this week.
I understand that I need to connect via bluetooth the computer and ESP32, and read the logs in PlatformIO?

@morcibacsi
Copy link
Owner

VAN log via bluetooth

If you comment out this line: https://github.com/morcibacsi/PSAVanCanBridge/blob/main/PSAVanCanBridge/Config.h#L9
and remove the comment from the start of the next line: https://github.com/morcibacsi/PSAVanCanBridge/blob/main/PSAVanCanBridge/Config.h#L10
then bluetooth will be started instead of wifi. You can follow this guide on capturing with a phone: https://github.com/morcibacsi/PSAVanCanBridge/blob/master/wiki/debugging.md#3-van-bus-capture--software-replay
The log can be saved to a file in the ... menu on the right by clicking the Data/save item.

VAN log via USB

If you don't have an Android phone but you have a laptop, then you can connect with an USB (make sure you don't connect the 12V from the car in this case). Also in this case you don't need to modify the config,h file, you need to use the wifi version.
See on how to open the serial monitor in Arduino here:
https://forum.arduino.cc/t/using-the-serial-monitor-for-debugging-analysing-what-is-going-on-inside-your-code/978443
(make sure you select the correct COM port, and enable the "Show timestamps" checkbox)
The serial monitor output can be copied to a text file.

The best would be to have two logs, one with the original display connected and C1 enabled (1-2 minutes is enough, you don't need to drive, just make sure you open and close the door a few times). And another log with C1 disabled, and the original display removed (same method as the previous, maybe until the BSI crashes). This way I can try comparing the original behavior and my version, and try figuring out what is the difference which causes the BSI to crash.

Also I had an idea, regarding the crash, it is a shot in the dark, but try increasing this value to 500 and disable C1 (and remove the original display to see if that fixes the issue)
https://github.com/morcibacsi/PSAVanCanBridge/blob/main/PSAVanCanBridge/src/Van/Writers/VanDisplayStatus.h#L14

Thank you very much for your help and patience.

@bronisMateusz
Copy link
Author

Ok, thanks for all the information. I have the logs. The one withoutC1 is really extensive, because I waited until the BSI stopped working.

logC1.txt
logWithoutC1.txt

Yesterday I also did another longer route (1.5 hours) and at the end I experienced strange behavior of the display and radio. They stopped working for a while. They would then turn on for a bit and turn off again (for longer and longer periods). This was a configuration with C1 turned on and the original display connected.

@morcibacsi
Copy link
Owner

Thanks for the log files. I analyzed them, and maybe I found something. To display the door status and consumption data the following happens: the BSI sends a message (lines starting with 0E 8C 4C) to the display that there is new data to show. When the display receives this message it sends a request (lines starting with 0E 56 4E) to the BSI for the new data. 56 4E is an awkward message as half of it is from the display, the other half is from the BSI.
With the original display it seems these messages are go side-by-side. So after a 8C 4C is received, a 56 4E follows immediately, and after that 8C 4C is received a bit later.
But with my code after I receive a 8C 4C even though I send the 56 4E almost immediately, the BSI keeps sending the 8C 4C, like if it wouldn't register my query with 56 4E.

I suspect I don't send the 56 4E "fast enough" after 8C 4C and the BSI keeps sending the 8C 4C again, and again. And maybe that causes the crash.

So... I would ask another pair of logs if you don't mind, where I can see the timestamps of the messages to verify this. As I saw you are using platformio on linux (?) I think you need to add monitor_filters = time to platformio.ini under monitor_speed to enable timestamps.

Yesterday I also did another longer route (1.5 hours) and at the end I experienced strange behavior of the display and radio. They stopped working for a while. They would then turn on for a bit and turn off again (for longer and longer periods). This was a configuration with C1 turned on and the original display connected.

I think this is caused by the overheating of the LM7805. I am going to modify the software so the Wifi hotspot won't be enabled all the time. That way the board won't draw that much current, so the LM7805 won't get overheated.

Repository owner deleted a comment from Drsimson Jan 10, 2024
Repository owner deleted a comment from Drsimson Jan 10, 2024
@bronisMateusz
Copy link
Author

Sorry it took so long, but I was busy during the week. I'm uploading more logs from today.

I'm using PlatformIO on Mac OS and had to add in platformio.ini exactly this line: monitor_filters = time.
(this is for people who would like to do something like this someday too)

As for the logs themselves, this logWithoutC1 is very extensive, as BSI work surprisingly well for a long time. It was only when I tried to reset the mileage by holding down the button on the right stalk (the one from the wipers) that the BSI stopped working.
logC1.txt
logWithoutC1.txt

I think this is caused by the overheating of the LM7805. I am going to modify the software so the Wifi hotspot won't be enabled all the time. That way the board won't draw that much current, so the LM7805 won't get overheated.

As for overheating, my board looks like this:
image
Karol mentioned to me that for lowering the temperature I should use a voltage converter. Maybe this also affects this problem.

@morcibacsi
Copy link
Owner

Sorry for the late reply, I was busy with other stuff. Thanks for the additional logs, I saw the same as before 8C 4C is sometimes keeps getting sent, but I am not really sure if that is a problem.
However indeed it is strange that this time it took longer before it crashed. I am working on a newer hw revision where the overheating issue will be resolved, and maybe thee TSS463 also won't be needed anymore. It will definitely take a few weeks to finish it, so please stay tuned.

@bronisMateusz
Copy link
Author

No problem, I know that such things can take some time. Can I still provide you with some additional data? A few comments earlier you mentioned:

Also I had an idea, regarding the crash, it is a shot in the dark, but try increasing this value to 500 and disable C1 (and remove the original display to see if that fixes the issue)
https://github.com/morcibacsi/PSAVanCanBridge/blob/main/PSAVanCanBridge/src/Van/Writers/VanDisplayStatus.h#L14

Would you still like to check it out?

@morcibacsi
Copy link
Owner

Well, you can give it a try, just to check all possibilities.

@Toniob
Copy link

Toniob commented Feb 28, 2024

I think I’ve got the same issue. What is the year of your car @bronisMateusz ? Mine is a 2002 model. Maybe it’s related ?

I’ve just installed the bridge in my car, with a RD45 and a new screen. I had to compile the main branch as the master didn’t work and made my bsi crash instantly. I had issues with the compilation of the main branch, as some of the includes are wrong (some includes of Config.h). After that, it worked, but after 10 minutes of tests, the bsi crashed again. I had to unplug the battery of the car.

Can I help with something ?

@morcibacsi
Copy link
Owner

I think I’ve got the same issue. What is the year of your car @bronisMateusz ? Mine is a 2002 model. Maybe it’s related ?

I’ve just installed the bridge in my car, with a RD45 and a new screen. I had to compile the main branch as the master didn’t work and made my bsi crash instantly. I had issues with the compilation of the main branch, as some of the includes are wrong (some includes of Config.h). After that, it worked, but after 10 minutes of tests, the bsi crashed again. I had to unplug the battery of the car.

Can I help with something ?

@Toniob Thanks for reaching out. The main branch is much more stable, and behaves more like the original display, so you should definitely use that.
I spent a few hours trying to make some sense of various VAN log files, but I couldn't see any obvious clues (apart from what I mentioned earlier). And (of course) I can't reproduce it in my car (but it is a 307 from 2004). This issue is so annoying. Unfortunately I am currently out of ideas on how to solve this. Except the workaround to hide the original display somewhere and enable C1 in the settings. If you could somehow solve it / debug it further that would be nice. And of course if you have any questions regarding the inner workings of the software, feel free to ask.

@Toniob
Copy link

Toniob commented Feb 28, 2024

Would it help if I send you some logs ?
And I don’t know if it’s related, but I didn’t manage to stop the thief protection. I’ve put my VIN number in the web interface and did the konami like code. Is it how it’s supposed to be done ?

@bronisMateusz
Copy link
Author

bronisMateusz commented Feb 28, 2024

@Toniob

What is the year of your car @bronisMateusz ?
Mine is from 2004.

If you are able to send logs, then you can check the solution that @morcibacsi mentioned. I, unfortunately, have not been able to log them recently. I will have the car again in about 3 weeks:

Also I had an idea, regarding the crash, it is a shot in the dark, but try increasing this value to 500 and disable C1 (and remove the original display to see if that fixes the issue)

https://github.com/morcibacsi/PSAVanCanBridge/blob/main/PSAVanCanBridge/src/Van/Writers/VanDisplayStatus.h#L14

PS: For the time being, I removed the superfluous components from the original B-type display I had and hid it behind the C-type display to keep it out of my way. This solution seems to be working at the moment. I also once spoke with a person who uses this design in Iran, and they also all do it this way for the 206.

PS2:

I had to unplug the battery of the car.

You do not need to do this. After the old display is counted again, remove the key from the ignition and wait several minutes (I wait about 20 minutes), after which time the BSI will go dormant. Turning the key again, should solve the problem and everything will return to normal.

@morcibacsi
Copy link
Owner

morcibacsi commented Feb 28, 2024

Would it help if I send you some logs ? And I don’t know if it’s related, but I didn’t manage to stop the thief protection. I’ve put my VIN number in the web interface and did the konami like code. Is it how it’s supposed to be done ?

Yes, if possible send some logs when the BSI crashes. Maybe I can figure out something.

VIN pairing shouldn't interfere with this. Strange you mentioned it doesn't work, it should. Both the keypresses, and the settings page auto-pair button.

@Toniob
Copy link

Toniob commented Feb 28, 2024

Thank you for your answers. I’ll try the auto-pair button tomorrow. How can I know if I need to use CAN2004 or CAN2010 ? Same question for the radio type. Should I use RD45 or RD45 2010 ?

And by the way, thank you for your awesome work.

@morcibacsi
Copy link
Owner

Thank you for your answers. I’ll try the auto-pair button tomorrow. How can I know if I need to use CAN2004 or CAN2010 ? Same question for the radio type. Should I use RD45 or RD45 2010 ?

And by the way, thank you for your awesome work.

CAN2004 (or AEE2004 to be precise) was used in older cars made until ~2012. After that PSA modified their CAN protocol (CAN2010/AEE2010) where some messages have been removed some changed and got new meaning.

If you have one of the 12 pin type displays, then you need to use CAN2004:
image
image

If you have the 6 pin display, you need to use CAN2010:
image

Take care that you can't mix AEE2010 and AEE2004 peripherals. So if you choose the 12pin display then it will only work with the "old version" of the RD4/RD43/RD45 which worked with the AEE2004 protocol.

@morcibacsi
Copy link
Owner

@bronisMateusz @Toniob Please send me a picture of the sticker on your BSI. Maybe I can buy the same type and try reproducing the issue on my bench.

@Toniob
Copy link

Toniob commented Feb 29, 2024

Here are 2 dumps. I’ve tested 2 different screens. Type C both of them, but not the same year, and the color are different. The BSI crashed the 2 times, quite fast (2 minutes tops). C1 was not activated and I didn’t have the old screen plugged in.

serial_20240229_103935.txt
serial_20240229_102926.txt

And here is a picture of the sticker
IMG_20240229_103356_762

@Toniob
Copy link

Toniob commented Feb 29, 2024

I’ve tested with C1 activated and it didn’t crash (I didn’t have to old screen attached). So it really seems it related to the VAN packets which are sent.

@morcibacsi
Copy link
Owner

Yes, definitely the sending is the problem, unfortunately it is required to have the trip computer working. So if C1 is activated and there is no original display installed, then the door statuses and the trip computer won't be available.

@Toniob
Copy link

Toniob commented Feb 29, 2024

Right now, I can live without the trip computer, that’s not a real issue for me. I can wait.

Do you think you can find the same BSI as I have ? Does @bronisMateusz have the same one ?

I’ve realized that my dumps are small. It didn’t put the buffer to unlimited. Do you want me to do them again, or you’ve got what you needed in them ?

@morcibacsi
Copy link
Owner

The dumps are fine. I managed to find a BSI, it will arrive next week. In the meantime I have an idea, to reduce the number of VAN sending and see if that helps. Please comment out this line to see if that changes anything.
https://github.com/morcibacsi/PSAVanCanBridge/blob/main/PSAVanCanBridge/src/Van/Writers/VanDisplayStatus.cpp#L7

I bought this BSI: https://allegro.pl/oferta/peugeot-206-modul-skrzynka-bsi-9646777380-europa-14608567084

@morcibacsi
Copy link
Owner

morcibacsi commented Feb 29, 2024

Ehh.... on second thought, please repeat the logging again.

@Toniob
Copy link

Toniob commented Feb 29, 2024

I bought this BSI: https://allegro.pl/oferta/peugeot-206-modul-skrzynka-bsi-9646777380-europa-14608567084

The number starting with S is a little different with mine. It ends with an E and not a G. But I don’t know if that’s a big difference.

I’ll try commenting the line you asked and test again soon. And I’ll make better logs this time ;)

@morcibacsi
Copy link
Owner

The number starting with S is a little different with mine. It ends with an E and not a G. But I don’t know if that’s a big difference.

Yeah, I saw that, couldn't find an exact match. Let's hope for the best.

@morcibacsi
Copy link
Owner

Oh and btw we have a nice community around PSA related development here, if you like joining. Everyone is welcome: https://discord.gg/DPthrN2cbS

@Toniob
Copy link

Toniob commented Feb 29, 2024

The dumps are fine. I managed to find a BSI, it will arrive next week. In the meantime I have an idea, to reduce the number of VAN sending and see if that helps. Please comment out this line to see if that changes anything. https://github.com/morcibacsi/PSAVanCanBridge/blob/main/PSAVanCanBridge/src/Van/Writers/VanDisplayStatus.cpp#L7

I had no crash with the version compiled with this line commented. With my other tests, the BSI crashed pretty quickly. But as you’ll see in the logs, more than 5 minutes, and it was still working.

Everything seemed fine, i could navigate in the menu, I had the trip informations.

serial_20240229_182108.txt

Did we find something ?

@morcibacsi
Copy link
Owner

Sounds promising 🙂 that message is required for the trip computer reset, but I can rewrite the code to send it a few times when the actual reset happens. Please test it for a few days, and we'll see what to do next.

@Toniob
Copy link

Toniob commented Mar 6, 2024

PS: For the time being, I removed the superfluous components from the original B-type display I had and hid it behind the C-type display to keep it out of my way. This solution seems to be working at the moment. I also once spoke with a person who uses this design in Iran, and they also all do it this way for the 206.

Hello @bronisMateusz . Do you have a description of the superfluous components you removed and how you did it ? Thank you

@bronisMateusz
Copy link
Author

bronisMateusz commented Mar 16, 2024

@morcibacsi I did a test today with increasing the value for the SEND_STATUS_INTERVAL variable with the original display disconnected and C1 set to false. Everything seems to work correctly, nothing bad happened. Here are the logs:
log500WithoutC1.txt

Hello @bronisMateusz . Do you have a description of the superfluous components you removed and how you did it ? Thank you

@Toniob I was a bit imprecise in my words. I simply removed the plastic casing from the display and placed it under the visor so that it could be put on easily:
IMG_0383-kopia
IMG_0384-kopia

@Toniob
Copy link

Toniob commented Mar 16, 2024

Thanks for you answer. I bought a used emf module, and I already did you’ve shown. I even removed the screen, to spare more space. And it’s working fine (and the car goes to sleep).

@morcibacsi
Copy link
Owner

@morcibacsi I did a test today with increasing the value for the SEND_STATUS_INTERVAL variable with the original display disconnected and C1 set to false.

What value did you use?

@bronisMateusz
Copy link
Author

500 as you suggested. I am driving the car right now and unfortunately the BSI has stopped working again

@morcibacsi
Copy link
Owner

@Toniob @bronisMateusz
Alright, I pushed some changes to the bsi_crash_fix branch please check if that helps resolving the BSI crash and the failure to send the BSI to sleep

@morcibacsi
Copy link
Owner

@Toniob @bronisMateusz Alright, I pushed some changes to the bsi_crash_fix branch please check if that helps resolving the BSI crash and the failure to send the BSI to sleep

Oh, and please also check if trip reset is still working.

And of course without the original display present.

@bronisMateusz
Copy link
Author

Ok, I ran tests today and strange things are happening. I tested for less than 15 minutes, including while driving and the BSI still worked properly. The button on top of the windshield wiper handle does not work. You can't switch between screens with it. Also, the statuses from the open doors don't work, nor the fuel consumption display.

I'll wait an hour or so, let the BSI sleep, and try to take another logs.

IMG_0386

@morcibacsi
Copy link
Owner

morcibacsi commented Mar 17, 2024

Ok, I ran tests today and strange things are happening. I tested for less than 15 minutes, including while driving and the BSI still worked properly. The button on top of the windshield wiper handle does not work. You can't switch between screens with it. Also, the statuses from the open doors don't work, nor the fuel consumption display.

Unfortunately I am not near my car, so I can't test the changes, but looking at the code the trip computer should work. Is there a chance that C1 was left enabled?

@bronisMateusz
Copy link
Author

bronisMateusz commented Mar 17, 2024

Interesting case. I went to check the situation again. In the config.h file I had these changes:

bool BRIDGE_REMOTE_STALK_DATA = true;
bool USE_IGNITION_SIGNAL_FROM_VAN_BUS = true;
uint8_t FUEL_TANK_CAPACITY_IN_LITERS = 50;
bool ENABLE_MANUAL_GEARBOX_DISPLAY = false;
uint8_t TIRE_SIZE = 17;
uint8_t TIRE_WIDTH = 205;
uint8_t TIRE_RATIO = 40;
uint8_t RADIO_TYPE = 2;

I went via bluetooth into the adapter settings, and there C1 was still selected, the tank capacity was also different from what I had set before uploading the code:
D49F6330-7CFB-4E5B-98BD-BBA373E678E3_4_5005_c
D69DBA1C-982B-469F-96B3-62B40F3D20D6_4_5005_c

In the attached file the moment of switching C1 from true to false there are about 16,000 lines of code. After that the door statuses and combustion indications actually returned. Trip reset suddenly not working.

@morcibacsi
Copy link
Owner

The settings from config.h are are just default values. As soon as you save the settings from the configuration page they are written to a file in the flash. On startup they are read from the file. So when the file exists changing the config.h has no effect (unless you delete it with the Delete config button). I try to check why the trip reset isn't working.

@bronisMateusz
Copy link
Author

Thanks for the clarification. I also forgot to include the second log file I mentioned in my previous message:
logBSICrashFix2.txt

@morcibacsi
Copy link
Owner

I fixed the trip reset.

@bronisMateusz
Copy link
Author

bronisMateusz commented Mar 17, 2024

I did more than 100 km with the car today. Everything worked perfectly 😁

Yesterday I will try fixed version

@bronisMateusz
Copy link
Author

Ok, I uploaded the latest version of the code, resetting the odometer actually works, but you have to hold the button for a long time, about 10 seconds, although looking at the code, it should be about 3 seconds.

This is not some big problem, I am writing this more for information.

IMG_0396.MOV

log.txt

@bronisMateusz
Copy link
Author

bronisMateusz commented Mar 19, 2024

I came back from a short drive and the BSI stopped working again unfortunately.

I'll check more in the coming days and maybe I'll be able to record the moment when the BSI crashes

@morcibacsi
Copy link
Owner

Damn, I was really hopeful that finally we made some progress. Please test it if you can, and in the meanwhile I will try to come up with something.

@bronisMateusz
Copy link
Author

I know, the whole thing is frustrating, so thank you all the more for having the will to keep looking for a solution to these problems.

I've had a couple of rides in the car recently and nothing bad has happened. I wondered what might have caused the BSI crash then and thought maybe it was that I had reset the trip data. I tried resetting the trip data today, waiting a similar period of time as I did then, but nothing bad happened. I have the logs from this trip, but I'm not attaching them this time because I don't think it's necessary.

Have you perhaps managed to guess why the trip reset button is not working as quickly as before?

@Toniob Are you able to check whether recent changes have also helped to solve problems in your car?

@Toniob
Copy link

Toniob commented Mar 25, 2024

I didn’t have the time to test or to take my car. My main issue is that I live in a city, without a garage. It’s not easy to test or to make modifications on the car. And if something goes wrong, like the last time, it’s a pain to charge the battery. But maybe I’ll do it at my parents next week.

@Toniob
Copy link

Toniob commented Apr 2, 2024

Good news on my side. I’ve tested the bsi_crash_fix branch yesterday. I made 2 trips of 20 minutes each, and the BSI didn’t crash. I’ve also tested the sleep mode and everything went well. Maybe I’ll try with a longer trip in the next few days, but for the moment, it seems I won’t need the original screen anymore.

@bronisMateusz
Copy link
Author

bronisMateusz commented Apr 2, 2024

Unfortunately, there are again problems on my part. I have been using the car extensively in the last few days and two days in a row I had a BSI failure. One occurred after 1.5h of driving and the other after just a few minutes. Yesterday I did another 1,5h tour and everything was ok.I will try to register something in the nearest days.

@Toniob In your car also reset trip performs after such a long time button press, as in my video?

@Toniob
Copy link

Toniob commented Apr 7, 2024

On friday, I made 2 trips of 2 hours each, and everything went ok with the BSI. But after the first, after a few hours, when I came back to the car, the display was not powering on. I had to unplug and plug again the bridge to make it work again. I think that's the esp32 which crashed. Too much heat maybe ?

Is there a way to have a watchdog on the bridge ? And if it doesn't reply anymore, it is rebooted automatically ? Something implemented in the ESP32 maybe ?

I also tried the trip reset and strange thing, the button on the car did nothing. No trip reset, but the button had no function anymore, not even the statistics display, as it should be. I'll probably try again another day. It remember it was working beofre so I really don't understand what happened.

@bronisMateusz
Copy link
Author

bronisMateusz commented Jul 8, 2024

Hi, I am back with the logs after this long break. To be honest, I had lost a bit of hope and opted for stability, i.e. driving with 2 displays plugged in, but nevertheless this topic kept me going. I managed to catch the moment again today that crash the BSI on the most recent version of the code from the bsi_crash_fix branch. I hope this will give new information for this problem.

log08.07.24.txt

Config.h:


#ifndef _Config_h
    #define _Config_h

#include <stdint.h>
#include <WString.h>

#include "Config_PSAVanCanBridge_WifiAp.h"
//#include "Config_PSAVanCanBridge_Bluetooth.h"
//#include "Config_WifiAp_Replay.h"
//#include "Config_WifiClient.h"

struct Config
{
    String  VERSION = "2.0.0";
    //#define PRINT_DEBUG

    #define VIN_LENGTH 17

    // 11: HW revision v1.1
    // 14: HW revision v1.4
    #define HW_VERSION 14

    #ifdef WIFI_ENABLED
        //#define WEBSOCKET_SERIAL
    #endif

    #ifndef WEBSOCKET_SERIAL
        // if defined messages are sent on bluetooth connection, otherwise standard serial is used
        #ifndef WIFI_ENABLED
            #define USE_BLUETOOTH_SERIAL
        #endif
    #endif

    const bool REPLAY_MODE = REPLAY_MODE_VALUE;

    // if true then we can control the display from the built-in webpage
    bool DISPLAY_CONTROL = false;

    bool ORIGINAL_DISPLAY_PRESENT = false;

    // if true then data of RD2/RD3 is bridged for the new display
    bool BRIDGE_RADIO_DATA = false;

    bool BRIDGE_ODOMETER_DATA = false;

    // if true then remote stalk data is bridged for the head unit
    bool BRIDGE_REMOTE_STALK_DATA = true;

    // if true then the ignition signal is used from the VAN bus otherwise the ignition is considered as always on
    bool USE_IGNITION_SIGNAL_FROM_VAN_BUS = true;

    //0: none / PSA CAN
    //1: PSA VAN - the distance data from the parking aid is queried with a diagnostic message (only works with rev 1.4)
    //2: Chinese
    uint8_t PARKING_AID_TYPE = 0;

    bool READ_SERIAL_PORT_FOR_COMMANDS = false;

    bool ENABLE_PARKING_AID_SOUND_FROM_SPEAKER = 0;

    uint8_t FUEL_TANK_CAPACITY_IN_LITERS = 50;

    uint32_t MILEAGE_AT_CMB_TRIP_RESET = 0;

    bool ENABLE_MANUAL_GEARBOX_DISPLAY = false;

    //0: final, 1: 1st, 2: 2nd ...
    float GEAR_RATIOS[7] = { 2.923, 1.869, 1.36, 1.051, 0.86, 0, 0 };

    //the values are in centimeters and are coming from observing the values of a 5008 from 2012
    uint8_t AAS_REAR_CORNER_DISTANCES[4] = { 60, 50, 40, 30 };
    uint8_t AAS_REAR_DISTANCES[4] = { 145, 100, 50, 30 };

    uint8_t TIRE_SIZE = 17;
    uint8_t TIRE_WIDTH = 205;
    uint8_t TIRE_RATIO = 40;

    // 0: CAN2004
    // 1: CAN2010
    uint8_t CAN_TYPE = 0;

    // 0: Aftermarket
    // 1: RD4/RD43
    // 2: RD45
    // 3: RD45 (CAN2010)
    // 4: RD3
    // 5: RTx
    uint8_t RADIO_TYPE = 2;

    bool DISPLAY_CONTROL_WITH_COM = false;

    bool LEFT_STICK_BUTTON_SHOWS_OIL_TEMP = false;

    bool USE_BRIGHTNESS_FROM_CAN_ODOMETER = false;
    uint8_t VIN_FOR_HEADUNIT[VIN_LENGTH] = { 0 };

    // if true, then SEND 0x167 on CAN bus
    bool NO_EMF_C_INSTALLED = false;

    // 1: original layout
    // 2: my layout (displays fuel level, vehicle speed, rpm instead of the basic trip computer data)
    uint8_t DISPLAY_MODE = 1;

    // if true then AC changes are sent to the display
    bool SEND_AC_CHANGES_TO_DISPLAY = false;

    // if true then AC changes are sent to the display
    bool SEND_AC_FAN_CHANGES_TO_DISPLAY = false;

    bool ENABLE_REVERSE_CAMERA_ON_RTX = false;

    // if true the AC status is queried with a diagnostic message (only works with rev 1.4)
    bool QUERY_AC_STATUS = false;

    const bool WIFI_AP_MODE = WIFI_AP_MODE_VALUE;
    const char* WIFI_AP_NAME = WIFI_AP_NAME_VALUE;
    const char* WIFI_SSID = WIFI_SSID_VALUE;
    const char* WIFI_PASSWORD = WIFI_PASSWORD_VALUE;

    Config();
};

#endif

IMG_0129
IMG_0130

@morcibacsi
Copy link
Owner

Thanks for the log, I'll try to investigate. I didn't have much time lately to work on the project (any project actually), the BSI I bough to investigate the issue is just resting on my desk, waiting to wire things up :(

@bronisMateusz
Copy link
Author

bronisMateusz commented Jul 10, 2024

I completely understand this. Also, I haven't uploaded my BSI version here before as I haven't had the car for a long time, but this is the 9650584680 version.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants