| | |
| | | } |
| | | |
| | | |
| | | void system_hanges(void); |
| | | int test_beep(void); |
| | | int test_relay(void); |
| | | int test_led(void); |
| | |
| | | MX_CAN1_Init(); |
| | | /* USER CODE BEGIN 2 */ |
| | | |
| | | printf("Welcome to ISKBoard v1.0\r\n"); |
| | | printf("Welcome to ISKBoard v1.0, compiled on %s %s\r\n", __DATE__, __TIME__); |
| | | |
| | | OLED_Init(); |
| | | ws2812b_init(); |
| | |
| | | } |
| | | |
| | | /* USER CODE BEGIN 4 */ |
| | | |
| | | void system_hanges(void) |
| | | { |
| | | while(1) |
| | | { |
| | | blink_led(LedRed, 500); |
| | | } |
| | | } |
| | | |
| | | int test_beep(void) |
| | | { |
| | |
| | | |
| | | cleanup: |
| | | if( rv ) |
| | | { |
| | | oled_show("MikroBUS [FAIL]"); |
| | | system_hanges(); |
| | | } |
| | | else |
| | | oled_show("MikroBUS [OK]"); |
| | | |
| | |
| | | } |
| | | |
| | | printf("ESP32 firmware version:\r\n%s\r\n", version); |
| | | |
| | | if( !strstr(version, "1.7.1.0") ) |
| | | { |
| | | printf("ERROR: ESP32 firmware not matched, please upgrade it first!\r\n"); |
| | | rv = -2; |
| | | goto cleanup; |
| | | } |
| | | init = 1; |
| | | } |
| | | |
| | | rv = send_atcmd_check_ok(comport, "AT", 500); |
| | | |
| | | cleanup: |
| | | printf("WiFi module AT test [%s]\r\n", rv?"FAIL":"OKAY"); |
| | | snprintf(oledstr, sizeof(oledstr), "WiFi: %s", rv?"FAIL":"OK"); |
| | | oled_show(oledstr); |
| | | |
| | | if( rv ) |
| | | system_hanges(); |
| | | |
| | | printf("\r\n"); |
| | | return 0; |
| | |
| | | { |
| | | printf("DS18B20 test [FAIL]\r\n"); |
| | | oled_show("DS18B20: [FAIL]"); |
| | | system_hanges(); |
| | | return -1; |
| | | } |
| | | |
| | |
| | | { |
| | | printf("SHT20 test [FAIL]\r\n"); |
| | | oled_show("SHT20: [FAIL]"); |
| | | system_hanges(); |
| | | return -1; |
| | | |
| | | } |
| | |
| | | rtc_time_t tm; |
| | | |
| | | if( get_rtc_time(&tm) < 0 ) |
| | | { |
| | | printf("RTC ISL1208 test [FAIL]\r\n"); |
| | | oled_show("RTC: [FAIL]"); |
| | | system_hanges(); |
| | | return -1; |
| | | } |
| | | |
| | | printf("RTC: %04d-%02d-%02d %02d:%02d:%02d %s\r\n", tm.tm_year, tm.tm_mon, tm.tm_mday, |
| | | tm.tm_hour, tm.tm_min, tm.tm_sec, weekday[tm.tm_wday]); |
| | |
| | | { |
| | | printf("USART3 RS232 test [FAIL]\r\n"); |
| | | oled_show("RS232 [FAIL]"); |
| | | system_hanges(); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | printf("CAN test [FAIL]\r\n"); |
| | | oled_show("CAN [FAIL]"); |
| | | system_hanges(); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | printf("RS485 test [FAIL]\r\n"); |
| | | oled_show("RS485 [FAIL]"); |
| | | system_hanges(); |
| | | } |
| | | else |
| | | { |