From 5f014635e1ddc1e8b3cc74b60a10a344945b992e Mon Sep 17 00:00:00 2001 From: Vehicle Researcher Date: Thu, 18 Jan 2018 15:42:12 -0800 Subject: [PATCH] Squashed 'panda/' changes from c371fe6..2573d86 2573d86 docs say max is 4, respect the docs 864cd8f failing on some devices 54bcc67 Merge pull request #75 from gregjhogan/j2534-vs-2017-upgrade 1664270 Merge pull request #74 from gregjhogan/j2534-disconnect-fix a7e3a8f bump panda version for serial bug aa0cfad fix UART hang 09ab8f6 add sendaddr support to isotp 40a1883 fix up baud rate 65997ff add PandaSerial and location panda (aka pigeon) test 57d633c upgraded to VS 2017 35cc32a fixed pointer exception on disconnect git-subtree-dir: panda git-subtree-split: 2573d861e605a2dcf456a6421b31e83fdd9ca606 --- VERSION | 2 +- __init__.py | 2 +- board/drivers/uart.h | 16 +- boardesp/proxy.c | 7 +- drivers/windows/ECUsim CLI/ECUsim CLI.vcxproj | 354 ++++++++-------- drivers/windows/ECUsim DLL/ECUsim DLL.vcxproj | 392 +++++++++--------- drivers/windows/panda/panda.vcxproj | 384 ++++++++--------- .../pandaJ2534DLL Test.vcxproj | 248 +++++------ .../pandaJ2534DLL/PandaJ2534Device.cpp | 2 +- .../pandaJ2534DLL/pandaJ2534DLL.vcxproj | 302 +++++++------- .../panda_playground/panda_playground.vcxproj | 380 ++++++++--------- examples/isotp.py | 8 +- python/__init__.py | 1 + python/serial.py | 27 ++ tests/location_listener.py | 48 +++ 15 files changed, 1130 insertions(+), 1043 deletions(-) create mode 100644 python/serial.py create mode 100755 tests/location_listener.py diff --git a/VERSION b/VERSION index 13637f44ae..3b9e5dbc90 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.0.3 \ No newline at end of file +v1.0.4 \ No newline at end of file diff --git a/__init__.py b/__init__.py index 912b4427cc..b802cf5a59 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1 @@ -from .python import Panda, PandaWifiStreaming, PandaDFU, ESPROM, CesantaFlasher, flash_release, BASEDIR, ensure_st_up_to_date, build_st +from .python import Panda, PandaWifiStreaming, PandaDFU, ESPROM, CesantaFlasher, flash_release, BASEDIR, ensure_st_up_to_date, build_st, PandaSerial diff --git a/board/drivers/uart.h b/board/drivers/uart.h index 85bab0e78d..2a21ffa23b 100644 --- a/board/drivers/uart.h +++ b/board/drivers/uart.h @@ -5,16 +5,19 @@ // esp = USART1 uart_ring esp_ring = { .w_ptr_tx = 0, .r_ptr_tx = 0, .w_ptr_rx = 0, .r_ptr_rx = 0, - .uart = USART1 }; + .uart = USART1, + .callback = NULL}; // lin1, K-LINE = UART5 // lin2, L-LINE = USART3 uart_ring lin1_ring = { .w_ptr_tx = 0, .r_ptr_tx = 0, .w_ptr_rx = 0, .r_ptr_rx = 0, - .uart = UART5 }; + .uart = UART5, + .callback = NULL}; uart_ring lin2_ring = { .w_ptr_tx = 0, .r_ptr_tx = 0, .w_ptr_rx = 0, .r_ptr_rx = 0, - .uart = USART3 }; + .uart = USART3, + .callback = NULL}; // debug = USART2 void debug_ring_callback(uart_ring *ring); @@ -59,7 +62,7 @@ void uart_ring_process(uart_ring *q) { q->uart->CR1 &= ~USART_CR1_TXEIE; } - if (sr & USART_SR_RXNE) { + if (sr & USART_SR_RXNE || sr & USART_SR_ORE) { uint8_t c = q->uart->DR; // TODO: can drop packets uint8_t next_w_ptr = q->w_ptr_rx + 1; if (next_w_ptr != q->r_ptr_rx) { @@ -68,6 +71,11 @@ void uart_ring_process(uart_ring *q) { if (q->callback) q->callback(q); } } + + if (sr & USART_SR_ORE) { + // set dropped packet flag? + } + exit_critical_section(); } diff --git a/boardesp/proxy.c b/boardesp/proxy.c index d7feb39c33..02e3473a53 100644 --- a/boardesp/proxy.c +++ b/boardesp/proxy.c @@ -225,8 +225,8 @@ void ICACHE_FLASH_ATTR wifi_init() { char password[] = "testing123"; // fetch secure ssid and password - // update, try 3 times - for (int i = 0; i < 3; i++) { + // update, try 20 times, for 1 second + for (int i = 0; i < 20; i++) { uint8_t digest[SHA_DIGEST_SIZE]; char resp[0x20]; __spi_comm("\x00\x00\x00\x00\x40\xD0\x00\x00\x00\x00\x20\x00", 0xC, recvData, 0x40); @@ -251,7 +251,7 @@ void ICACHE_FLASH_ATTR wifi_init() { config.ssid_len = strlen(ssid); config.authmode = AUTH_WPA2_PSK; config.beacon_interval = 100; - config.max_connection = 10; + config.max_connection = 4; wifi_softap_set_config(&config); //set IP @@ -354,7 +354,6 @@ void ICACHE_FLASH_ATTR user_init() { system_os_post(LOOP_PRIO, 0, 0); } - void ICACHE_FLASH_ATTR loop(os_event_t *events) { system_os_post(LOOP_PRIO, 0, 0); } diff --git a/drivers/windows/ECUsim CLI/ECUsim CLI.vcxproj b/drivers/windows/ECUsim CLI/ECUsim CLI.vcxproj index 9ac10e8bc1..4b9de8c442 100644 --- a/drivers/windows/ECUsim CLI/ECUsim CLI.vcxproj +++ b/drivers/windows/ECUsim CLI/ECUsim CLI.vcxproj @@ -1,178 +1,178 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {D99E2FCD-21A4-4065-949A-31E34E0E69D1} - Win32Proj - ECUsimCLI - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - false - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - false - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib - - - - - Use - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib - - - - - Level3 - Use - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib - - - - - - - - - - - Create - Create - Create - Create - - - - - {96e0e646-ee76-444d-9a77-a0cd7f781deb} - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {D99E2FCD-21A4-4065-949A-31E34E0E69D1} + Win32Proj + ECUsimCLI + 10.0.16299.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + false + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + false + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib + + + + + Use + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)ecusim.lib + + + + + + + + + + + Create + Create + Create + Create + + + + + {96e0e646-ee76-444d-9a77-a0cd7f781deb} + + + + + \ No newline at end of file diff --git a/drivers/windows/ECUsim DLL/ECUsim DLL.vcxproj b/drivers/windows/ECUsim DLL/ECUsim DLL.vcxproj index d50a0a2918..93d75c14be 100644 --- a/drivers/windows/ECUsim DLL/ECUsim DLL.vcxproj +++ b/drivers/windows/ECUsim DLL/ECUsim DLL.vcxproj @@ -1,197 +1,197 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {96E0E646-EE76-444D-9A77-A0CD7F781DEB} - Win32Proj - ECUsimDLL - 8.1 - - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - ecusim - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - true - ecusim - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - false - ecusim - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - false - ecusim - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Windows - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib - - - - - Use - Level3 - Disabled - _DEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Windows - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Windows - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib - - - - - Level3 - Use - MaxSpeed - true - true - NDEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Windows - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib - - - - - - - - - - - false - - - false - - - false - - - false - - - - - - Create - Create - Create - Create - - - - - {5528aefb-638d-49af-b9d4-965154e7d531} - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {96E0E646-EE76-444D-9A77-A0CD7F781DEB} + Win32Proj + ECUsimDLL + 10.0.16299.0 + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + ecusim + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + true + ecusim + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + false + ecusim + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + false + ecusim + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Windows + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib + + + + + Use + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Windows + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Windows + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;ECUSIMDLL_EXPORTS;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Windows + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib + + + + + + + + + + + false + + + false + + + false + + + false + + + + + + Create + Create + Create + Create + + + + + {5528aefb-638d-49af-b9d4-965154e7d531} + + + + + \ No newline at end of file diff --git a/drivers/windows/panda/panda.vcxproj b/drivers/windows/panda/panda.vcxproj index 147c58ca14..a84b2fcce2 100644 --- a/drivers/windows/panda/panda.vcxproj +++ b/drivers/windows/panda/panda.vcxproj @@ -1,193 +1,193 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {5528AEFB-638D-49AF-B9D4-965154E7D531} - Win32Proj - panda - 8.1 - - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - false - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - false - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) - true - false - - - Windows - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib - - - - - Use - Level3 - Disabled - _DEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) - true - - - Windows - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib - - - - - Level3 - Use - MaxSpeed - true - true - NDEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib - - - - - - - - - - - - - false - - - false - - - false - - - false - - - - - - Create - Create - Create - Create - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {5528AEFB-638D-49AF-B9D4-965154E7D531} + Win32Proj + panda + 10.0.16299.0 + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + false + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + false + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) + true + false + + + Windows + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib + + + + + Use + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_WINDOWS;_USRDLL;PANDA_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);winusb.lib;setupapi.lib + + + + + + + + + + + + + false + + + false + + + false + + + false + + + + + + Create + Create + Create + Create + + + + + + + + + + + \ No newline at end of file diff --git a/drivers/windows/pandaJ2534DLL Test/pandaJ2534DLL Test.vcxproj b/drivers/windows/pandaJ2534DLL Test/pandaJ2534DLL Test.vcxproj index 56923823ba..d415b1fd79 100644 --- a/drivers/windows/pandaJ2534DLL Test/pandaJ2534DLL Test.vcxproj +++ b/drivers/windows/pandaJ2534DLL Test/pandaJ2534DLL Test.vcxproj @@ -1,125 +1,125 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {7912F978-B48C-4C5D-8BFD-5D1E22158E47} - Win32Proj - pandaJ2534DLLTest - 8.1 - Tests - - - - DynamicLibrary - true - v140 - Unicode - false - - - DynamicLibrary - false - v140 - true - Unicode - false - - - - - - - - - - - - - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - - Use - Level3 - Disabled - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(SolutionDir) - WIN32;_DEBUG;%(PreprocessorDefinitions) - true - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib - - - - - Level3 - Use - MaxSpeed - true - true - $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(SolutionDir) - WIN32;NDEBUG;%(PreprocessorDefinitions) - true - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - {96e0e646-ee76-444d-9a77-a0cd7f781deb} - - - {a2bb18a5-f26b-48d6-bbb5-b83d64473c77} - - - {5528aefb-638d-49af-b9d4-965154e7d531} - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {7912F978-B48C-4C5D-8BFD-5D1E22158E47} + Win32Proj + pandaJ2534DLLTest + 10.0.16299.0 + Tests + + + + DynamicLibrary + true + v141 + Unicode + false + + + DynamicLibrary + false + v141 + true + Unicode + false + + + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + + Use + Level3 + Disabled + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(SolutionDir) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib + + + + + Level3 + Use + MaxSpeed + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(SolutionDir) + WIN32;NDEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + {96e0e646-ee76-444d-9a77-a0cd7f781deb} + + + {a2bb18a5-f26b-48d6-bbb5-b83d64473c77} + + + {5528aefb-638d-49af-b9d4-965154e7d531} + + + + + \ No newline at end of file diff --git a/drivers/windows/pandaJ2534DLL/PandaJ2534Device.cpp b/drivers/windows/pandaJ2534DLL/PandaJ2534Device.cpp index 64da8e2c3d..6a78271fdc 100644 --- a/drivers/windows/pandaJ2534DLL/PandaJ2534Device.cpp +++ b/drivers/windows/pandaJ2534DLL/PandaJ2534Device.cpp @@ -112,7 +112,7 @@ DWORD PandaJ2534Device::can_recv_thread() { } } else { for (auto& conn : this->connections) - if (conn->isProtoCan() && conn->getPort() == msg_in.bus) + if (conn != nullptr && conn->isProtoCan() && conn->getPort() == msg_in.bus) conn->processMessage(msg_out); } } diff --git a/drivers/windows/pandaJ2534DLL/pandaJ2534DLL.vcxproj b/drivers/windows/pandaJ2534DLL/pandaJ2534DLL.vcxproj index 065fa69adc..6e32122b8b 100644 --- a/drivers/windows/pandaJ2534DLL/pandaJ2534DLL.vcxproj +++ b/drivers/windows/pandaJ2534DLL/pandaJ2534DLL.vcxproj @@ -1,152 +1,152 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {A2BB18A5-F26B-48D6-BBB5-B83D64473C77} - Win32Proj - pandaJ2534DLL - 8.1 - - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - pandaJ2534_0404_32 - - - false - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - pandaJ2534_0404_32 - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;PANDAJ2534DLL_EXPORTS;%(PreprocessorDefinitions) - true - $(SolutionDir); - - - Windows - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);version.lib;$(OutDir)panda.lib - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PANDAJ2534DLL_EXPORTS;%(PreprocessorDefinitions) - true - $(SolutionDir); - - - Windows - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);version.lib;$(OutDir)panda.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - false - - - - - - - - - - - - - - - Create - Create - - - - - - {5528aefb-638d-49af-b9d4-965154e7d531} - - - - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + {A2BB18A5-F26B-48D6-BBB5-B83D64473C77} + Win32Proj + pandaJ2534DLL + 10.0.16299.0 + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + pandaJ2534_0404_32 + + + false + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + pandaJ2534_0404_32 + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;PANDAJ2534DLL_EXPORTS;%(PreprocessorDefinitions) + true + $(SolutionDir); + + + Windows + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);version.lib;$(OutDir)panda.lib + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;PANDAJ2534DLL_EXPORTS;%(PreprocessorDefinitions) + true + $(SolutionDir); + + + Windows + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);version.lib;$(OutDir)panda.lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + + + + + + + + + + + + + Create + Create + + + + + + {5528aefb-638d-49af-b9d4-965154e7d531} + + + + + + + + + + + \ No newline at end of file diff --git a/drivers/windows/panda_playground/panda_playground.vcxproj b/drivers/windows/panda_playground/panda_playground.vcxproj index 0063bebceb..2b5f3120c3 100644 --- a/drivers/windows/panda_playground/panda_playground.vcxproj +++ b/drivers/windows/panda_playground/panda_playground.vcxproj @@ -1,191 +1,191 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {691DB635-C272-4B98-897E-0505B970DCA9} - Win32Proj - panda_playground - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - $(ProjectName)2 - - - true - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - $(ProjectName) - - - false - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - false - $(SolutionDir)$(Configuration)_$(PlatformShortName)\ - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib - - - - - Use - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib - - - - - Level3 - Use - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - %(AdditionalIncludeDirectories);$(SolutionDir) - - - Console - true - true - true - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - {96e0e646-ee76-444d-9a77-a0cd7f781deb} - - - {a2bb18a5-f26b-48d6-bbb5-b83d64473c77} - - - {5528aefb-638d-49af-b9d4-965154e7d531} - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {691DB635-C272-4B98-897E-0505B970DCA9} + Win32Proj + panda_playground + 10.0.16299.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + $(ProjectName)2 + + + true + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + $(ProjectName) + + + false + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + false + $(SolutionDir)$(Configuration)_$(PlatformShortName)\ + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib + + + + + Use + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib + + + + + Level3 + Use + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + %(AdditionalIncludeDirectories);$(SolutionDir) + + + Console + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);$(OutDir)panda.lib;$(OutDir)ecusim.lib + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + {96e0e646-ee76-444d-9a77-a0cd7f781deb} + + + {a2bb18a5-f26b-48d6-bbb5-b83d64473c77} + + + {5528aefb-638d-49af-b9d4-965154e7d531} + + + + + \ No newline at end of file diff --git a/examples/isotp.py b/examples/isotp.py index 8d7a98e773..12cef80a96 100644 --- a/examples/isotp.py +++ b/examples/isotp.py @@ -43,9 +43,13 @@ def recv(panda, cnt, addr, nbus): kmsgs = nmsgs return map(str, ret) -def isotp_recv(panda, addr, bus=0): +def isotp_recv(panda, addr, bus=0, sendaddr=None): msg = recv(panda, 1, addr, bus)[0] + if sendaddr is None: + sendaddr = addr-8 + + if ord(msg[0])&0xf0 == 0x10: # first tlen = ((ord(msg[0]) & 0xf) << 8) | ord(msg[1]) @@ -54,7 +58,7 @@ def isotp_recv(panda, addr, bus=0): # 0 block size? CONTINUE = "\x30" + "\x00"*7 - panda.can_send(addr-8, CONTINUE, bus) + panda.can_send(sendaddr, CONTINUE, bus) idx = 1 for mm in recv(panda, (tlen-len(dat) + 7)/8, addr, bus): diff --git a/python/__init__.py b/python/__init__.py index 95a2b89d24..48f6bf17a6 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -12,6 +12,7 @@ from dfu import PandaDFU from esptool import ESPROM, CesantaFlasher from flash_release import flash_release from update import ensure_st_up_to_date +from serial import PandaSerial __version__ = '0.0.6' diff --git a/python/serial.py b/python/serial.py new file mode 100644 index 0000000000..1bcfebb32e --- /dev/null +++ b/python/serial.py @@ -0,0 +1,27 @@ +# mimic a python serial port +class PandaSerial(object): + def __init__(self, panda, port, baud): + self.panda = panda + self.port = port + self.panda.set_uart_parity(self.port, 0) + self.panda.set_uart_baud(self.port, baud) + self.buf = "" + + def read(self, l=1): + tt = self.panda.serial_read(self.port) + if len(tt) > 0: + #print "R: ", tt.encode("hex") + self.buf += tt + ret = self.buf[0:l] + self.buf = self.buf[l:] + return ret + + def write(self, dat): + #print "W: ", dat.encode("hex") + #print ' pigeon_send("' + ''.join(map(lambda x: "\\x%02X" % ord(x), dat)) + '");' + return self.panda.serial_write(self.port, dat) + + def close(self): + pass + + diff --git a/tests/location_listener.py b/tests/location_listener.py new file mode 100755 index 0000000000..59f83cf59d --- /dev/null +++ b/tests/location_listener.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +import os +import time +import sys + +sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) +from panda import Panda, PandaSerial + +def add_nmea_checksum(msg): + d = msg[1:] + cs = 0 + for i in d: + cs ^= ord(i) + return msg + "*%02X" % cs + +if __name__ == "__main__": + panda = Panda() + ser = PandaSerial(panda, 1, 9600) + + # power cycle by toggling reset + print "resetting" + panda.set_esp_power(0) + time.sleep(0.5) + panda.set_esp_power(1) + time.sleep(0.5) + print "done" + print ser.read(1024) + + # upping baud rate + # 460800 has issues + baudrate = 460800 + + print "upping baud rate" + msg = add_nmea_checksum("$PUBX,41,1,0007,0003,%d,0" % baudrate)+"\r\n" + print msg + ser.write(msg) + time.sleep(0.1) # needs a wait for it to actually send + + # new panda serial + ser = PandaSerial(panda, 1, baudrate) + + while True: + ret = ser.read(1024) + if len(ret) > 0: + sys.stdout.write(ret) + sys.stdout.flush() + #print str(ret).encode("hex") +