comparison Discovery/Src/base.c @ 395:eb7696e0510f ImproveBluetooth

Added start of module configuration after eache modul power on Added button evaluation to support request for bluetooth signal stragth
author ideenmodellierer
date Tue, 26 Nov 2019 21:17:57 +0100
parents 427ae9f8e28e
children b11e50415982
comparison
equal deleted inserted replaced
394:717f335cc5c9 395:eb7696e0510f
360 360
361 SystemClock_Config(); 361 SystemClock_Config();
362 362
363 MX_GPIO_Init(); 363 MX_GPIO_Init();
364 // MX_SmallCPU_NO_Reset_Helper(); //161116 hw 364 // MX_SmallCPU_NO_Reset_Helper(); //161116 hw
365 MX_Bluetooth_PowerOff(); /* disable module, needed in case of e.g. a reset event to make sure module is configured from scratch */
365 MX_SPI_Init(); 366 MX_SPI_Init();
366 MX_UART_Init(); 367 MX_UART_Init();
367 SDRAM_Config(); 368 SDRAM_Config();
368 HAL_Delay( 100 ); 369 HAL_Delay( 100 );
369 370
384 TIM_BACKLIGHT_init(); 385 TIM_BACKLIGHT_init();
385 386
386 // new 170508: bluetooth on at start 387 // new 170508: bluetooth on at start
387 settingsGetPointer()->bluetoothActive = 1; 388 settingsGetPointer()->bluetoothActive = 1;
388 MX_Bluetooth_PowerOn(); 389 MX_Bluetooth_PowerOn();
389 390 tComm_StartBlueModConfig();
390 // Haase Geburtstag:
391 // settingsGetPointer()->serialHigh = (3012 / 256);
392 // settingsGetPointer()->serialLow = (3012 & 0xFF);
393
394 // settingsGetPointer()->showDebugInfo = 1;
395 391
396 /* 392 /*
397 if( (hardwareDataGetPointer()->primarySerial == 20+18) 393 if( (hardwareDataGetPointer()->primarySerial == 20+18)
398 || (hardwareDataGetPointer()->primarySerial == 20+25) 394 || (hardwareDataGetPointer()->primarySerial == 20+25)
399 || (hardwareDataGetPointer()->primarySerial == 20+27)) 395 || (hardwareDataGetPointer()->primarySerial == 20+27))
481 updateMenu(); 477 updateMenu();
482 ext_flash_write_settings(); 478 ext_flash_write_settings();
483 } 479 }
484 deco_loop(); 480 deco_loop();
485 TriggerButtonAction(); 481 TriggerButtonAction();
486 if(DoDisplayRefresh) 482 if(DoDisplayRefresh) /* set every 100ms by timer interrupt */
487 { 483 {
488 DoDisplayRefresh = 0; 484 DoDisplayRefresh = 0;
489 RefreshDisplay(); 485 RefreshDisplay();
490 486
491 if(stateUsed->mode == MODE_DIVE) /* handle motion events in divemode only */ 487 if(stateUsed->mode == MODE_DIVE) /* handle motion events in divemode only */
1015 #endif 1011 #endif
1016 1012
1017 get_globalStateList(&status); 1013 get_globalStateList(&status);
1018 if(status.base == BaseComm) /* main loop is not serviced in comm mode => react immediately */ 1014 if(status.base == BaseComm) /* main loop is not serviced in comm mode => react immediately */
1019 { 1015 {
1020 if (action == ACTION_BUTTON_BACK) { 1016 switch(action)
1021 settingsGetPointer()->bluetoothActive = 0; 1017 {
1022 MX_Bluetooth_PowerOff(); 1018 case ACTION_BUTTON_BACK: tComm_exit();
1023 tComm_exit(); 1019 break;
1020 case ACTION_BUTTON_NEXT: tComm_RequestBluetoothStrength();
1021 break;
1022 default:
1023 break;
1024 } 1024 }
1025 } 1025 }
1026 else 1026 else
1027 { 1027 {
1028 StoreButtonAction(action); /* Handle action in main loop */ 1028 StoreButtonAction(action); /* Handle action in main loop */