Open Garden  0.10.1-21
Functions
queue.c File Reference

queue functions. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "queue.h"
Include dependency graph for queue.c:

Functions

void print_qstatus (struct programs_t *progs, struct debug_t *debug, const uint8_t index)
 
void print_qline (struct programs_t *progs, struct debug_t *debug, const uint8_t index)
 
void q_push (struct programs_t *progs, struct tm *tm_clock, const uint8_t i)
 queue a program to be executed. More...
 
void q_pop (struct programs_t *progs, const uint8_t i)
 
void q_purge (struct programs_t *progs)
 
void run (struct programs_t *progs, const time_t tnow, const uint8_t index)
 
void stop (struct programs_t *progs, const uint8_t index)
 
void queue_run (struct programs_t *progs, struct tm *tm_clock, struct debug_t *debug)
 
void queue_list (struct programs_t *progs, struct debug_t *debug)
 

Detailed Description

queue functions.

Function Documentation

◆ print_qline()

void print_qline ( struct programs_t progs,
struct debug_t debug,
const uint8_t  index 
)

print a single queue line.

◆ print_qstatus()

void print_qstatus ( struct programs_t progs,
struct debug_t debug,
const uint8_t  index 
)

add a stack ? add the 1 time ram only flag?

print the status of a queue element.

Parameters
progs
debug
indexthe indexed element of the queue.

◆ q_pop()

void q_pop ( struct programs_t progs,
const uint8_t  i 
)

remmove a program from the queue

◆ q_purge()

void q_purge ( struct programs_t progs)

Remove Q_OFF element from the queue.

◆ q_push()

void q_push ( struct programs_t progs,
struct tm tm_clock,
const uint8_t  i 
)

queue a program to be executed.

Parameters
progsthe programs struct.
tm_clockthe time.
ithe program number to be pushed into the queue.

◆ queue_list()

void queue_list ( struct programs_t progs,
struct debug_t debug 
)

list all valid programs

◆ queue_run()

void queue_run ( struct programs_t progs,
struct tm tm_clock,
struct debug_t debug 
)

Check which program in the queue to exec.

Cycle trough the queue and open/close the lines. The compiler flag OG_QUEUE_PERMIT_MULTIPLE_OLINES if present let more than one line to be open at the same time. The purge from the queue of those Q_OFF (already completed) element is done at the end of the cycle, where changing index range should not be a problem.

Parameters
progs
tm_clocktime now.
debug
Bug:
With bistable valve opening and closing oline cannot be done at the same time, any io-action must be done on separate queue-run.
Note
the printed infos rappresent the status of a queue before.
Q_DELAYED should never appear if multiple lines are permitted.
Warning
Use the exit var to stop the loop, do not change the index (i) or the print of the queue status will no longer work.

◆ run()

void run ( struct programs_t progs,
const time_t  tnow,
const uint8_t  index 
)

Open the oline of the indexed queue element.

Open the current oline of the index queue element recalculating the duration of the cycle like when a delayed start case.

Parameters
progs
tnowthe time
indexthe indexed element.

◆ stop()

void stop ( struct programs_t progs,
const uint8_t  index 
)

Close the oline of the current queue element.

Parameters
progs
index