Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:7fa61b250083, committed 2020-06-01
- Comitter:
- Marcelocostanzo
- Date:
- Mon Jun 01 23:15:05 2020 +0000
- Parent:
- 0:81f7d0ea45b6
- Child:
- 2:17d61cc5f0c0
- Commit message:
- versao com 57600 de baud, funcionando
Changed in this revision
--- a/codes.h Mon Jun 01 20:26:10 2020 +0000 +++ b/codes.h Mon Jun 01 23:15:05 2020 +0000 @@ -22,7 +22,7 @@ #define LINEFEED_OFF "ATL0" #define PRINTING_SPACES_OFF "ATS0" #define MEMORY_OFF "ATM0" -#define SET_TIMEOUT_256 "ATST64" +#define SET_TIMEOUT_256 "ATST10" #define TRY_PROTOCOL_0 "ATTP0" #define DESCRIBRE_PROTOCOL_NAME "ATDP" #define DESCRIBRE_PROTOCOL_NUMBER "ATDPN"
--- a/main.cpp Mon Jun 01 20:26:10 2020 +0000 +++ b/main.cpp Mon Jun 01 23:15:05 2020 +0000 @@ -4,7 +4,7 @@ DigitalOut myled(LED1); -Serial pc(USBTX,USBRX); +//Serial pc(USBTX,USBRX); Serial device(PA_11, PA_12); @@ -46,23 +46,23 @@ int main() { flipper.attach(&flip, 1.0); - pc.baud(115200); + //pc.baud(115200); - lcd.speed (SSD1306::Medium); // set working frequency + lcd.speed (SSD1306::Fast); // set working frequency lcd.init(); // initialize SSD1306 lcd.set_contrast(255); lcd.cls(); // clear frame buffer lcd.locate (3,2); // set text cursor to line 3, column 1 lcd.printf ("Starting up"); // print to frame buffer - pc.printf("OBD STM32 v1.1.002"); - pc.printf("\r\n"); + //pc.printf("OBD STM32 v1.1.002"); + //pc.printf("\r\n"); - device.baud(38400); + device.baud(57600); OBDInit(); - pc.printf("OBD Inicializado"); - pc.printf("\r\n"); + //pc.printf("OBD Inicializado"); + //pc.printf("\r\n"); lcd.cls(); lcd.locate(3,0); @@ -73,39 +73,45 @@ lcd.cls(); lcd.redraw(); - int FREQ = 600; + int FREQ = 80; while(1) { ask_intake_pressure_absolute(); - wait_ms(FREQ); - ask_engine_rpm(); + lcd.locate(0,0); + lcd.printf("%+03.2f bar",INTAKE_PRESSURE_ABSOLUTE); wait_ms(FREQ); - //ask_vehile_speed(); - //wait_ms(FREQ); - ask_intake_air_temperature(); - wait_ms(FREQ); - ask_throttle_position(); - wait_ms(FREQ); - ask_oxygen_sensor(); - wait_ms(FREQ); - ask_fuel_rail_pressure(); + + ask_engine_rpm(); + lcd.locate(1,0); + lcd.printf("%04i RPM",ENGINE_RPM); wait_ms(FREQ); - lcd.locate(0,0); - lcd.printf("%03.2f bar",INTAKE_PRESSURE_ABSOLUTE); - lcd.locate(1,0); - lcd.printf("%04i RPM",ENGINE_RPM); + //ask_vehile_speed(); lcd.locate(2,0); lcd.printf("%03i Km/h",VEHILE_SPEED); + //wait_ms(FREQ); + + ask_intake_air_temperature(); lcd.locate(3,0); lcd.printf("%03i C",INTAKE_AIR_TEMPERATURE); + wait_ms(FREQ); + + ask_throttle_position(); lcd.locate(4,0); lcd.printf("%05.2f pc",THROTTLE_POSITION); + wait_ms(FREQ); + + ask_oxygen_sensor(); lcd.locate(5,0); lcd.printf("%04.3f mV",OXYGEN_SENSOR); + wait_ms(FREQ); + + ask_fuel_rail_pressure(); lcd.locate(6,0); lcd.printf("%06.2f bar",FUEL_RAIL_PRESSURE); + wait_ms(FREQ); + lcd.redraw(); //lcd.cls(); @@ -146,12 +152,12 @@ INTAKE_PRESSURE_ABSOLUTE = (VAL_A * 0.01f) - 1.0f; - pc.printf("pressao %i\r",INTAKE_AIR_TEMPERATURE); + //pc.printf("pressao %i\r",INTAKE_AIR_TEMPERATURE); - for(int j = 0; j < i; j++) - { - pc.printf("%c",RESPONSE_INTAKE_PRESSURE_ABSOLUTE[j]); - } + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",RESPONSE_INTAKE_PRESSURE_ABSOLUTE[j]); + //} } void ask_engine_rpm() @@ -186,12 +192,12 @@ ENGINE_RPM = ((VAL_A * 256) + VAL_B) / 4; - pc.printf("rpm %i\r",ENGINE_RPM); + //pc.printf("rpm %i\r",ENGINE_RPM); - for(int j = 0; j < i; j++) - { - pc.printf("%c",RESPONSE_ENGINE_RPM[j]); - } + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",RESPONSE_ENGINE_RPM[j]); + //} } void ask_vehile_speed() @@ -221,12 +227,12 @@ VEHILE_SPEED = VAL_A; - pc.printf("%i kmh\r",VEHILE_SPEED); + //pc.printf("%i kmh\r",VEHILE_SPEED); - for(int j = 0; j < i; j++) - { - pc.printf("%c",RESPONSE_VEHILE_SPEED[j]); - } + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",RESPONSE_VEHILE_SPEED[j]); + //} } void ask_intake_air_temperature() @@ -256,12 +262,12 @@ INTAKE_AIR_TEMPERATURE = VAL_A - 40;; - pc.printf("temp ar %i\r",INTAKE_AIR_TEMPERATURE); + //pc.printf("temp ar %i\r",INTAKE_AIR_TEMPERATURE); - for(int j = 0; j < i; j++) - { - pc.printf("%c",RESPONSE_INTAKE_AIR_TEMPERATURE[j]); - } + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",RESPONSE_INTAKE_AIR_TEMPERATURE[j]); + //} } void ask_throttle_position() @@ -292,12 +298,12 @@ THROTTLE_POSITION = 100.0f/255.0f; THROTTLE_POSITION = THROTTLE_POSITION * VAL_A; - pc.printf("tbi %.2f\r",THROTTLE_POSITION); + //pc.printf("tbi %.2f\r",THROTTLE_POSITION); - for(int j = 0; j < i; j++) - { - pc.printf("%c",RESPONSE_THROTTLE_POSITION[j]); - } + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",RESPONSE_THROTTLE_POSITION[j]); + //} } void ask_oxygen_sensor() @@ -334,13 +340,13 @@ SHORT_TERM_FUEL_TRIM = ((100.0f / 128.0f) * VAL_B) - 100.0f; - pc.printf("sonda %f\r",OXYGEN_SENSOR); - pc.printf("trim %f\r",SHORT_TERM_FUEL_TRIM); + //pc.printf("sonda %f\r",OXYGEN_SENSOR); + //pc.printf("trim %f\r",SHORT_TERM_FUEL_TRIM); - for(int j = 0; j < i; j++) - { - pc.printf("%c",RESPONSE_OXYGEN_SENSOR[j]); - } + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",RESPONSE_OXYGEN_SENSOR[j]); + //} } void ask_fuel_rail_pressure() @@ -374,12 +380,12 @@ FUEL_RAIL_PRESSURE = ((VAL_A * 256) + VAL_B) * 0.1f; - pc.printf("alta %f\r",FUEL_RAIL_PRESSURE); + //pc.printf("alta %f\r",FUEL_RAIL_PRESSURE); - for(int j = 0; j < i; j++) - { - pc.printf("%c",RESPONSE_FUEL_RAIL_PRESSURE[j]); - } + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",RESPONSE_FUEL_RAIL_PRESSURE[j]); + //} } void read_serial() @@ -393,11 +399,10 @@ //pc.printf("%c",c[i]); i++; } - for(int j = 0; j < i; j++) - { - pc.printf("%c",c[j]); - } - i=0; //zeramos o contador de posicao + //for(int j = 0; j < i; j++) + //{ + //pc.printf("%c",c[j]); + //} } void OBDInit() @@ -407,90 +412,99 @@ lcd.redraw(); device.printf(SET_ALL_TO_DEFAULT); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,1); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); lcd.locate (4,2); lcd.printf ("."); lcd.redraw(); device.printf(RESET_ALL); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,3); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); lcd.locate (4,4); lcd.printf ("."); lcd.redraw(); device.printf(LINEFEED_OFF); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,5); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); lcd.locate (4,6); lcd.printf ("."); lcd.redraw(); device.printf(PRINTING_SPACES_OFF); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,7); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); lcd.locate (4,8); lcd.printf ("."); lcd.redraw(); device.printf(MEMORY_OFF); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,9); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); lcd.locate (4,10); lcd.printf ("."); lcd.redraw(); device.printf(SET_TIMEOUT_256); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,11); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); lcd.locate (4,12); lcd.printf ("."); lcd.redraw(); device.printf(TRY_PROTOCOL_0); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,13); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); lcd.locate (4,14); lcd.printf ("."); lcd.redraw(); device.printf(ECHO_OFF); device.printf(CR); - wait_ms(500); + wait_ms(200); lcd.locate (4,15); lcd.printf ("."); lcd.redraw(); - wait_ms(500); + wait_ms(200); - device.printf("ATLP"); - device.printf(CR); - wait_ms(500); + //device.printf("ATPP0CSV45"); + //device.printf("ATBRD45"); + //device.printf(CR); + //wait_ms(200); + //device.baud(57600); + //device.printf("ATPP0CON"); + //device.printf(CR); + //wait_ms(200); + + //device.printf("ATLP"); + //device.printf(CR); + //wait_ms(200); } \ No newline at end of file
--- a/ssd1306_library.lib Mon Jun 01 20:26:10 2020 +0000 +++ b/ssd1306_library.lib Mon Jun 01 23:15:05 2020 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/rodriguj/code/ssd1306_library/#57209a7e9cba +https://os.mbed.com/users/rodriguj/code/ssd1306_library/#3df2a0b8906b