|  |  | @ -3,6 +3,7 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <cmath> |  |  |  | #include <cmath> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <iostream> |  |  |  | #include <iostream> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <fstream> |  |  |  | #include <fstream> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #include <future> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <signal.h> |  |  |  | #include <signal.h> | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QVBoxLayout> |  |  |  | #include <QVBoxLayout> | 
			
		
	
	
		
		
			
				
					|  |  | @ -92,29 +93,31 @@ void GLWindow::timerUpdate(){ | 
			
		
	
		
		
			
				
					
					|  |  |  |   // Update brightness
 |  |  |  |   // Update brightness
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   float clipped_brightness = std::min(1023.0f, (ui_state->light_sensor*brightness_m) + brightness_b); |  |  |  |   float clipped_brightness = std::min(1023.0f, (ui_state->light_sensor*brightness_m) + brightness_b); | 
			
		
	
		
		
			
				
					
					|  |  |  |   smooth_brightness = clipped_brightness * 0.01f + smooth_brightness * 0.99f; |  |  |  |   smooth_brightness = clipped_brightness * 0.01f + smooth_brightness * 0.99f; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   int brightness = smooth_brightness; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (brightness_control.is_open()){ |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     brightness_control << int(smooth_brightness) << "\n"; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     brightness_control.close(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   ui_update(ui_state); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | #ifdef QCOM2 |  |  |  | #ifdef QCOM2 | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (ui_state->started != onroad){ |  |  |  |   if (ui_state->started != onroad){ | 
			
		
	
		
		
			
				
					
					|  |  |  |     onroad = ui_state->started; |  |  |  |     onroad = ui_state->started; | 
			
		
	
		
		
			
				
					
					|  |  |  |     timer->setInterval(onroad ? 50 : 1000); |  |  |  |     timer->setInterval(onroad ? 50 : 1000); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     int brightness = onroad ? 1023 : 0; |  |  |  |   if (!ui_state->started){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     brightness = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #endif | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   std::async(std::launch::async, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |              [brightness]{ | 
			
		
	
		
		
			
				
					
					|  |  |  |                std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness"); |  |  |  |                std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                if (brightness_control.is_open()){ |  |  |  |                if (brightness_control.is_open()){ | 
			
		
	
		
		
			
				
					
					|  |  |  |       brightness_control << int(brightness) << "\n"; |  |  |  |                  brightness_control << brightness << "\n"; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                  brightness_control.close(); |  |  |  |                  brightness_control.close(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                } |  |  |  |                } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |              }); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | #endif |  |  |  | 
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   ui_update(ui_state); | 
			
		
	
		
		
			
				
					
					|  |  |  |   update(); |  |  |  |   update(); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |