comparison Discovery/Src/base.c @ 878:6b06143cbfea Evo_2_23

brightness settings and proper power down for new screen
author heinrichsweikamp
date Sun, 25 Aug 2024 18:55:43 +0200
parents 17d9d6eddd8d
children 8d3f3a635397
comparison
equal deleted inserted replaced
877:a0900e4df15c 878:6b06143cbfea
1000 1000
1001 static void gotoSleep(void) 1001 static void gotoSleep(void)
1002 { 1002 {
1003 /* not at the moment of testing */ 1003 /* not at the moment of testing */
1004 // ext_flash_erase_firmware_if_not_empty(); 1004 // ext_flash_erase_firmware_if_not_empty();
1005 GFX_logoAutoOff(); 1005 GFX_logoAutoOff();
1006 display_power_off();
1006 ext_flash_write_devicedata(true); /* write data at default position */ 1007 ext_flash_write_devicedata(true); /* write data at default position */
1007 ext_flash_write_settings(true); /* write data at default position */ 1008 ext_flash_write_settings(true); /* write data at default position */
1008 set_globalState(StStop); 1009 set_globalState(StStop);
1009 } 1010 }
1010 1011
1255 switch( pSettings->brightness + blBoost) 1256 switch( pSettings->brightness + blBoost)
1256 { 1257 {
1257 case 0: /* Cave */ 1258 case 0: /* Cave */
1258 levelMax = 3000;/* max 25 % (x2) */ 1259 levelMax = 3000;/* max 25 % (x2) */
1259 levelMin = 1500; 1260 levelMin = 1500;
1261 if (hardwareDisplay == 1) display_1_brightness_cave();
1260 break; 1262 break;
1261 case 1: /* Eco */ 1263 case 1: /* Eco */
1262 levelMax = 6000;/* max 50 % (x2) */ 1264 levelMax = 6000;/* max 50 % (x2) */
1263 levelMin = 3000; 1265 levelMin = 3000;
1266 if (hardwareDisplay == 1) display_1_brightness_eco();
1264 break; 1267 break;
1265 case 2: /* Std */ 1268 case 2: /* Std */
1266 levelAmbient += 1000; 1269 levelAmbient += 1000;
1267 levelMax = 9000; 1270 levelMax = 9000;
1268 levelMin = 4500; 1271 levelMin = 4500;
1269 levelUpStep_100ms += levelUpStep_100ms/2; // 4500 instead of 3000 1272 levelUpStep_100ms += levelUpStep_100ms/2; // 4500 instead of 3000
1270 levelDnStep_100ms += levelDnStep_100ms/2; 1273 levelDnStep_100ms += levelDnStep_100ms/2;
1274 if (hardwareDisplay == 1) display_1_brightness_std();
1271 break; 1275 break;
1272 case 3: /* High */ 1276 case 3: /* High */
1273 default: 1277 default:
1274 levelAmbient += 3000; 1278 levelAmbient += 3000;
1275 levelMax = 12000; /* max 100% (x2) */ 1279 levelMax = 12000; /* max 100% (x2) */
1276 levelMin = 6000; 1280 levelMin = 6000;
1277 levelUpStep_100ms += levelUpStep_100ms; // 6000 instead of 3000 1281 levelUpStep_100ms += levelUpStep_100ms; // 6000 instead of 3000
1278 levelDnStep_100ms += levelDnStep_100ms; 1282 levelDnStep_100ms += levelDnStep_100ms;
1283 if (hardwareDisplay == 1) display_1_brightness_high();
1279 break; 1284 break;
1280 case 4: /* New Max */ 1285 case 4: /* New Max */
1281 levelAmbient = 12000; 1286 levelAmbient = 12000;
1282 levelMax = 12000; /* max 100% (x2) */ 1287 levelMax = 12000; /* max 100% (x2) */
1283 levelMin = 12000; 1288 levelMin = 12000;
1284 levelUpStep_100ms += 12000; 1289 levelUpStep_100ms += 12000;
1285 levelDnStep_100ms += 0; 1290 levelDnStep_100ms += 0;
1291 if (hardwareDisplay == 1) display_1_brightness_max();
1286 break; 1292 break;
1287 } 1293 }
1288 1294
1289 if((pSettings->brightness != brightnessModeLast))// || wasLostConnection) 1295 if((pSettings->brightness != brightnessModeLast))// || wasLostConnection)
1290 { 1296 {
1343 HAL_TIM_PWM_Init(&TimBacklightHandle); 1349 HAL_TIM_PWM_Init(&TimBacklightHandle);
1344 1350
1345 sConfig.OCMode = TIM_OCMODE_PWM1; 1351 sConfig.OCMode = TIM_OCMODE_PWM1;
1346 sConfig.OCPolarity = TIM_OCPOLARITY_HIGH; 1352 sConfig.OCPolarity = TIM_OCPOLARITY_HIGH;
1347 sConfig.OCFastMode = TIM_OCFAST_DISABLE; 1353 sConfig.OCFastMode = TIM_OCFAST_DISABLE;
1348 sConfig.Pulse = 100; /* Initial brigthness of display */ 1354 sConfig.Pulse = 100; /* Initial brightness of display */
1349 1355
1350 HAL_TIM_PWM_ConfigChannel(&TimBacklightHandle, &sConfig, TIM_BACKLIGHT_CHANNEL); 1356 HAL_TIM_PWM_ConfigChannel(&TimBacklightHandle, &sConfig, TIM_BACKLIGHT_CHANNEL);
1351 HAL_TIM_PWM_Start(&TimBacklightHandle, TIM_BACKLIGHT_CHANNEL); 1357 HAL_TIM_PWM_Start(&TimBacklightHandle, TIM_BACKLIGHT_CHANNEL);
1352 } 1358 }
1353 #endif 1359 #endif