Cleanup changes
This commit is contained in:
		
							parent
							
								
									e268d49c48
								
							
						
					
					
						commit
						1d75a5bc77
					
				
					 1 changed files with 19 additions and 28 deletions
				
			
		
							
								
								
									
										47
									
								
								main.cpp
									
										
									
									
									
								
							
							
						
						
									
										47
									
								
								main.cpp
									
										
									
									
									
								
							|  | @ -26,7 +26,7 @@ | |||
| #define COMMAND_BUFFER_SIZE 64 | ||||
| #define SNPRINTF_BUFFER_SIZE 96 | ||||
| 
 | ||||
| #define welcomeString "HELO SAS" | ||||
| #define welcomeString "HELOJANA" | ||||
| static constexpr bool bdayMsg = false; | ||||
| 
 | ||||
| void buttonHandler(uint8_t index, uint8_t type, void* data); | ||||
|  | @ -70,8 +70,10 @@ ISR(TIMER2_OVF_vect) | |||
| { | ||||
| 	display.tick(); | ||||
| 	buttons.tick(); | ||||
| 	if(ringging && ((timer % 4 == 0 && timer < 128) || (timer > 128 && timer % 16 == 0)) ) writePin(&PORTD, PD4, true); | ||||
| 	else writePin(&PORTD, PD4, false); | ||||
| 	if(ringging && ((timer % 4 == 0 && timer < 128) || (timer > 128 && timer % 16 == 0))) | ||||
| 		writePin(&PORTD, PD4, true); | ||||
| 	else | ||||
| 		writePin(&PORTD, PD4, false); | ||||
| 	++timer; | ||||
| } | ||||
| 
 | ||||
|  | @ -90,8 +92,15 @@ void buttonHandler(uint8_t index, uint8_t type, void* data) | |||
| 		} | ||||
| 		else if(index == 1 && type == Buttons::RELEASED ) | ||||
| 		{ | ||||
| 			if(!ringging) if(++alm > 3) alm = 0; | ||||
| 				else ringging = false; | ||||
| 			if(!ringging) | ||||
| 			{ | ||||
| 				if(++alm > 3) | ||||
| 					alm = 0; | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				ringging = false; | ||||
| 			} | ||||
| 		} | ||||
| 		else if(index == 1 && type == Buttons::LONG_PRESSED ) | ||||
| 		{ | ||||
|  | @ -339,7 +348,6 @@ int main() | |||
| 	TCCR1B = 1<<CS10; | ||||
| 
 | ||||
| 	EICRA = 1<<ISC10; | ||||
| 	EIMSK = 1<<INT1; | ||||
| 
 | ||||
| 	sei(); | ||||
| 
 | ||||
|  | @ -352,34 +360,16 @@ int main() | |||
| 	alm = EEPROM_read_char(0); | ||||
| 	uint8_t oldAlm = alm; | ||||
| 
 | ||||
| 
 | ||||
| #ifdef HAS_TRANSMITTER | ||||
| 	char name[] = "relay"; | ||||
| 	WirelessRelay relay(0b1011010001000000, name); | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAS_DHT | ||||
| 	Dht11 sensor(&PORTD, &PIND, &DDRD, PD2); | ||||
| #endif | ||||
| 	if(time.day == 28 && time.month == 5) | ||||
| 	{ | ||||
| 		if constexpr(bdayMsg) | ||||
| 		{ | ||||
| 			display.setString("HAPPY   "); | ||||
| 			_delay_ms(1000); | ||||
| 			display.setString("b-DAY   "); | ||||
| 			_delay_ms(1000); | ||||
| 			display.setString("SASA    "); | ||||
| 			_delay_ms(1000); | ||||
| 		} | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		display.setString(welcomeString); | ||||
| 		_delay_ms(1000); | ||||
| 	} | ||||
| 	display.setString(welcomeString); | ||||
| 	_delay_ms(1000); | ||||
| 
 | ||||
| #ifdef HAS_DHT | ||||
| 	Dht11 sensor(&PORTD, &PIND, &DDRD, PD2); | ||||
| 	sensor.read(); | ||||
| 	_delay_ms(1000); | ||||
| 	sensor.read(); | ||||
|  | @ -443,6 +433,7 @@ int main() | |||
| #else | ||||
| 		displayItems(time, 0, 0); | ||||
| #endif | ||||
| 
 | ||||
| 		if(time.hour == alarmA.hour && time.min == alarmA.min && time.sec == 0) | ||||
| 		{ | ||||
| 			ringging = true; | ||||
|  | @ -457,8 +448,8 @@ int main() | |||
| #endif | ||||
| 		} | ||||
| 
 | ||||
| #ifdef HAS_RECIVER | ||||
| 		serialDispatch(&serial, &sensors); | ||||
| #ifdef HAS_RECIVER | ||||
| 		if(deleteDate != time.day) | ||||
| 		{ | ||||
| 			displaying = 0; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue