add: pulse mode
add: editorconfig
This commit is contained in:
		
							parent
							
								
									679175f1a9
								
							
						
					
					
						commit
						0f342b4aa8
					
				
					 13 changed files with 151 additions and 70 deletions
				
			
		| 
						 | 
				
			
			@ -11,6 +11,7 @@ typedef struct
 | 
			
		|||
    uint8_t pin;
 | 
			
		||||
    int inverted;
 | 
			
		||||
    relay_driver_t driver;
 | 
			
		||||
    uint8_t pulse_duration;
 | 
			
		||||
} config_relay_t;
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,6 +24,7 @@ typedef enum
 | 
			
		|||
    COMMAND_MAPPING_SCHEDULE_ID = 4,
 | 
			
		||||
    COMMAND_MAPPING_PERIODS_COUNT = 5,
 | 
			
		||||
    COMMAND_MAPPING_PERIODS_BLOB = 6,
 | 
			
		||||
    COMMAND_MAPPING_PULSE_DURATION = 7,
 | 
			
		||||
} control_mapping_t;
 | 
			
		||||
 | 
			
		||||
typedef enum
 | 
			
		||||
| 
						 | 
				
			
			@ -36,6 +37,7 @@ typedef enum
 | 
			
		|||
    COMMAND_CODE_GET_SCHEDULE = 103,
 | 
			
		||||
    COMMAND_CODE_SET_RELAY_NAME = 104,
 | 
			
		||||
    COMMAND_CODE_GET_RELAY_NAME = 105,
 | 
			
		||||
    COMMAND_CODE_PULSE = 200,
 | 
			
		||||
} command_code_t;
 | 
			
		||||
 | 
			
		||||
typedef enum
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,8 @@ typedef struct
 | 
			
		|||
{
 | 
			
		||||
    uint8_t number;
 | 
			
		||||
    int is_on;
 | 
			
		||||
    int is_on_schedule;
 | 
			
		||||
    int pulse_timer;
 | 
			
		||||
    int sent_to_broker;
 | 
			
		||||
    char name[MAX_NAME_LENGTH + 1];
 | 
			
		||||
    schedule_t *schedules[7];
 | 
			
		||||
| 
						 | 
				
			
			@ -53,7 +55,7 @@ int
 | 
			
		|||
relay_save(relay_t *relay, MDB_env *mdb_env);
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
relay_is_active(relay_t *relay, struct tm *time_struct);
 | 
			
		||||
relay_is_on_schedule(relay_t *relay, struct tm *time_struct);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
relay_free(relay_t *relay);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,12 +4,13 @@
 | 
			
		|||
#include <logger.h>
 | 
			
		||||
 | 
			
		||||
#ifdef WIRING_PI_DEBUG
 | 
			
		||||
    #define wiringPiSetup() LOG_DEBUG("wiringPi wiringPiSetup()\n")
 | 
			
		||||
    #define wiringPiSetupSys() LOG_DEBUG("wiringPi wiringPiSetupSys()\n")
 | 
			
		||||
    #define pinMode(x,y) LOG_DEBUG("wiringPi pinMode(%d, %d)\n", x, y)
 | 
			
		||||
    #define digitalWrite(x,y) LOG_DEBUG("wiringPi digitalWrite(%d, %d)\n", x, y)
 | 
			
		||||
    #define LOG_WIRING_PI LOG_TRACE
 | 
			
		||||
    #define wiringPiSetup() LOG_WIRING_PI("wiringPi wiringPiSetup()\n")
 | 
			
		||||
    #define wiringPiSetupSys() LOG_WIRING_PI("wiringPi wiringPiSetupSys()\n")
 | 
			
		||||
    #define pinMode(x,y) LOG_WIRING_PI("wiringPi pinMode(%d, %d)\n", x, y)
 | 
			
		||||
    #define digitalWrite(x,y) LOG_WIRING_PI("wiringPi digitalWrite(%d, %d)\n", x, y)
 | 
			
		||||
 | 
			
		||||
    #define piFaceSetup(x) LOG_DEBUG("wiringPi piFaceSetup(%d)\n", x)
 | 
			
		||||
    #define piFaceSetup(x) LOG_WIRING_PI("wiringPi piFaceSetup(%d)\n", x)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* CONTROLLER_WIRING_DEBUG_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue