SingingCat 0
application
Files | Data Structures | Macros | Typedefs | Functions | Variables
Application

Files

file  boot_info.c
 constants is a struct in a special RAM area which is not cleared on reset
 
file  command-handler.c
 main command processor
 
file  command-parser.c
 code to encode/decode commands to a serialized or in-ram format
 
file  constants.c
 constants is a struct in a special RAM area which is not cleared on reset
 
file  decode_esp_packet.c
 packetizes streams from esp including escape/unescape
 
file  fets.c
 code to drive the fets
 
file  flashapp.c
 handling of flash via streams
 
file  forwarding.c
 code to forward to other nodes
 
file  forwarding.h
 definitions of routing table structures
 
file  led.c
 code to make the pretty LED blink
 
file  onewire.c
 code to interface via onewire. (uses bit-banging and timer)
 
file  packetbuffer.c
 packetizes streams of data from radio or wifi
 
file  powersave.c
 code to manage sensors by server
 
file  queue.c
 code to queue outbound commands. this is the "normal" way of sending out commands
 
file  routing.c
 code to discover other nodes
 
file  routing.h
 definitions of routing table structures
 
file  routing_functions.h
 definitions of routing table structures
 
file  sensor.c
 code to call all the sensors in the right frequency, with the correct configuration modify this file if you have new sensors!
 
file  sensor_command.c
 code to manage sensors by server
 
file  streams.c
 handling of streams
 
file  user_app_exe.c
 user application interface
 
file  userhooks.c
 START HERE - definition of user hooks to implement additional functionality.
 

Data Structures

struct  espbuf
 
struct  hostroute
 
struct  ledcolour
 
struct  leddef
 
struct  power_state
 
struct  powersavething
 
struct  queue_entry
 
struct  sensorconfig
 definition of variable stuff for any one sensor this is seperate from runtime, because a copy will live in flash (cnw: err, no, not with a volatile pointer (*sensor)!!) More...
 
struct  stbuf
 

Macros

#define AT_COMMAND_OK   2
 baudrate [0=9600,1=19200,2=38400,3=57600,4=115200,5=230400,6=460800,7=921600,8=74880] More...
 
#define AT_COMMAND_TIMEOUT   7
 
#define BROADCAST   0xFFFFFFFF
 
#define CHECK_TI1101_FAILURE   if (ti1101_failed) { ti1101_failure(); return; }
 
#define CHECK_TI1101_FAILURE_S   if (ti1101_failed) { ti1101_failure(); printf("TI1101 failed\r\n"); return; }
 
#define CHECK_TI1101_FAILURE_V   if (ti1101_failed) { ti1101_failure(); return 0; }
 
#define CNWDEBUGCOM(a, ...)   noop()
 
#define COM_QUEUE_SIZE   80
 
#define COMMAND_AGE_BEFORE_GC   120
 maximum amount of time a packet may remain allocated More...
 
#define command_names_size   60
 
#define ESP8266_AFTER_BOOT_DEFAULT_BAUDRATE   9600
 
#define ESPMODE_ISAP   1
 
#define HOSTROUTE_ENTRIES   40
 
#define isNewStyleEnabled   (sensors_enabled & (1 << 1))
 
#define isOldStyleEnabled   (sensors_enabled & (1 << 0))
 
#define isProbing   (sensors_enabled & (1 << 2))
 
#define LED_TIMER_FREQUENCY   130
 
#define MAX_ROUTE_AGE_SECONDS   600
 any route that has not been used or seen for longer than this is subject to removal (the garbage collector) More...
 
#define MAX_SECS_BEFORE_DELAYED_START   10
 
#define MAX_SECS_BETWEEN_LOOP_SAMPLES   5
 
#define MAX_SECS_BETWEEN_RADIO_BROADCASTS   300
 
#define MAX_SECS_BETWEEN_STOP_WARNING   10
 
#define MAX_SECS_BETWEEN_WIFI_DETECT   600
 how often to check if a wifichip is attached More...
 
#define MCULIB_USERAPP_HANDLE   7
 
#define MEMAREA_SIZE   4096
 
#define ONEWIRE_INTERVAL   600
 
#define SECONDS_BEFORE_ATTEMPTING_TO_RECONNECT   600
 if we fail to log in to [ssid], we fallback to 'singingcat'. If so, how often shall we retry to connect to [ssid] More...
 
#define SECONDS_BEFORE_ESP_FAIL   30
 if esp8266 fails to provide a valid ip after this time: reinitialise More...
 
#define SECONDS_BEFORE_ESP_RESET_FAIL   30
 after reset, how long before failure detection starts More...
 
#define SECS_AFTER_BOOT_BEFORE_POWERSAFE   120
 
#define SECS_AFTER_LASTCOM_BEFORE_POWERSAFE   3
 
#define SECS_AFTER_WAKE_BEFORE_POWERSAFE   10
 
#define SECS_BETWEEN_CLOUD_PROBES   300
 how often to probe the cloud connection More...
 
#define SECS_UNTIL_CONNECTION_DEAD   (SECS_BETWEEN_CLOUD_PROBES * 4)
 if we don't receive an answer for this long (in seconds) assume connection is dead More...
 
#define SENSOR_FLAG_ACTIVATED   4
 
#define SENSOR_FLAG_DETECTED   2
 
#define SENSOR_FLAG_ENABLED   0
 
#define SENSOR_FLAG_ISDUE   1
 
#define SENSOR_FLAG_PROBED   3
 
#define SENSOR_TIMER   4
 timer to use More...
 
#define SENSOR_TIMER_FREQUENCY   1000
 frequency our timer runs on More...
 
#define TI1101_BURST   0x40
 
#define TI1101_READ   0x80
 

Typedefs

typedef struct espbuf _espbuf
 
typedef struct hostroute _hostroute
 
typedef struct ledcolour _ledcolour
 
typedef struct leddef _leddef
 
typedef struct power_state _power_state
 
typedef struct powersavething _powersavething
 
typedef struct queue_entry _queue_entry
 
typedef struct sensorconfig _sensorconfig
 definition of variable stuff for any one sensor this is seperate from runtime, because a copy will live in flash (cnw: err, no, not with a volatile pointer (*sensor)!!)
 
typedef struct stbuf _stbuf
 

Functions

int _command_add_encoded_arg (struct command *com, byte *buf)
 
long adr_create_new_node_id ()
 
int adr_isvalid (long a)
 
int all_sensors_probed ()
 
struct commandalloc_command ()
 allocate a free command More...
 
struct commandalloc_command_with_minfree (int minfree)
 
struct streamalloc_stream ()
 find a free stream struct, alloc an fd and return struct More...
 
int app_main (void)
 
void app_main_no_return () __attribute__((noreturn))
 
int ascii_commandstring_to_num (const byte *buf, int size, int *const newpos)
 match a string to a command num. More...
 
void bridge_packet (struct command *com)
 
void calc_power_mode ()
 
void cat_send_local_instruction (const PACKET_TYPE type, const uint8_t *buf, const int len)
 send a packet to the esp8266 wifi chip More...
 
void check_close (struct stream *stream)
 check if closing flash ist set and we received all the data up to close packet if, flush and close stream More...
 
void check_strobe ()
 
void clear_outbound_queue ()
 clear the outbound queue any commands within the queue are silently discarded More...
 
void close_stream (int fd, int reason)
 
void command_add_arg (struct command *com, const char *format,...)
 adds an arg to a partially initialised command structure More...
 
int command_add_binary_arg (struct command *com, const int len, const byte *srcbuf)
 adds a binary parameter to command returns 0 if ok otherwise errorcode More...
 
void command_add_varg (struct command *com, const char *format, va_list args)
 adds a varg list of parameters to a command More...
 
byte command_calc_checksum (struct command *com)
 
int command_decode_ascii (struct command *com, const byte *buf, int size, int version)
 
int command_decode_binary (struct command *com, const byte *buf, int size)
 
int command_encode_ascii (struct command *com, int bufsize, char *buf)
 encode a command to an ascii blob properly surrounded by '{' and '}' and escaped returns length if ok or <0 if error More...
 
const char * command_get_name (int num)
 given a command number returns its name More...
 
char * command_get_source_name (byte sourcedev)
 returns a human readable text identifying a source device More...
 
void command_init (struct command *com)
 initialize a command structure with default values More...
 
struct commandcommand_parse (const byte *buf, int size)
 
void command_print (struct command *com)
 prints a command in human readable format to serial console More...
 
void command_start ()
 initialization for command parser More...
 
void console_add_byte (uint8_t b)
 
uint16_t console_get_byte ()
 
int console_get_line (char *outbuf, int outbufsize)
 
void console_reset ()
 
struct constsconstants ()
 
int constants_init ()
 
void constants_print ()
 
void constants_validate ()
 
int count_open_streams ()
 count number of open streams More...
 
void create_new_node_id ()
 
void dac_timer ()
 
const char * decisionname (int decision)
 
void decode_esp_packet_init ()
 
const char * decode_marcstate (int state)
 
int deliver_command (struct command *com, pkt_callback cb)
 deliver a command to a module More...
 
void enter_esp_passthrough_mode ()
 
void error_com (void *com)
 
void esp8266_add_ap (const char *ssid, const char *pw)
 add an ap to the list of known ap More...
 
int esp8266_add_byte (byte b)
 feed this with one byte at a time More...
 
void esp8266_bridge ()
 bridge debug serialport and esp8266 (e.g. "wifidebug") More...
 
void esp8266_cloud_connection_failed ()
 called if the cloud connection failed More...
 
void esp8266_cloud_loop ()
 called from esp8266 event loop if we are connected More...
 
void esp8266_decoder_print_info ()
 
void esp8266_disable ()
 disable the esp8266 (switch it off) More...
 
void esp8266_dodebug (const char *paras)
 
void esp8266_enable ()
 enable the esp8266 (switch it on) More...
 
void esp8266_event_loop ()
 
byte * esp8266_get_buf ()
 get the buffer More...
 
int esp8266_get_chip ()
 
struct ipv4addressesp8266_get_current_ip ()
 return last ip (null if none) More...
 
uint64_t esp8266_get_firmware_base ()
 
int esp8266_get_firmware_repo ()
 
int esp8266_get_firmware_version ()
 
long esp8266_get_invalid_commands ()
 
int esp8266_get_operational_baudrate ()
 
long esp8266_get_time_of_last_ip ()
 
long esp8266_get_valid_commands ()
 
void esp8266_got_packet (const byte *buf, int size)
 
int esp8266_is_accespoint ()
 returns !=0 if we are currently an accesspoint More...
 
int esp8266_is_enabled ()
 
byte esp8266_is_in_packet ()
 returns 1 if currently parsing a packet More...
 
void esp8266_ota ()
 tell the esp to do an OTA More...
 
int esp8266_packet_size ()
 returns 0 if no packet is in buf, otherwise returns size of packet in bytes More...
 
void esp8266_read_byte_from_serialport (int val)
 this is called directly from the usart IRQ. be quick. and do not use printf() More...
 
void esp8266_reset ()
 reset state machine and esp8266 More...
 
void esp8266_reset_buf ()
 reset buf, e.g. after packet was processed More...
 
void esp8266_reset_command_validity_ctrs ()
 
void esp8266_send_config ()
 
void esp8266_send_instructions ()
 send our nodeid and other goodies to the esp8266 chip More...
 
void esp8266_set_operational_baudrate (int baudrate)
 
char * esp8266_status_string ()
 returns a human readable status string of the wifi connection More...
 
void esp8266_test ()
 
void esp8266_wifi_scan (struct command *com)
 
void esp8266_wififlash_bridge (void)
 set esp8266 to flash mode, sync and then bridge ("startflash") More...
 
void esp_cloud_activate ()
 activate the cloud. More...
 
void esp_cloud_answered (struct command *com, struct command *reply)
 called on command timeout or reply More...
 
const char * esp_cloud_connect_state_string ()
 
void esp_cloud_deactivate ()
 
const char * esp_cloud_get_desired_server ()
 returns server we want to connect to More...
 
void esp_cloud_init ()
 this resets the cloud state More...
 
byte esp_cloud_is_activated ()
 return 1 if cloud connection is activated More...
 
int esp_cloud_is_connected ()
 
void esp_cloud_state_update (int code, int data)
 whenever the esp chip sends us an update about the cloud state this gets called by the event handler for the esp8266 (not in irq) More...
 
void esp_empty_ringbuffer ()
 empties the ringbuffer. More...
 
const char * esp_get_last_pw ()
 
const char * esp_get_last_ssid ()
 
int esp_get_mac (char *buf, int bufsize)
 get the esp8266 mac address. More...
 
void esp_info ()
 
void esp_init ()
 call this ONCE before calling anything else More...
 
int esp_read_mac ()
 
void factory_default (struct command *com)
 set the module back to factory default More...
 
void fets_init ()
 
void fets_loop ()
 
void fets_set_com (struct command *com)
 
void flagstostr (char *buf, int flags)
 given a pointer to a buffer and command flags, it will fill the buffer with a human readable text describing the flags More...
 
int flash_app_close (int fd, int reason)
 
int flash_app_consumer (int streamfd, byte *b, int size)
 called by stream whenever we got sufficient bytes (and only on full blocks!) More...
 
int flash_app_init (void *base, uint32_t flags)
 
void flash_debug ()
 
int flash_write (byte *b, void *adr, int size)
 unlock, erase, write, lock More...
 
void flashcom (struct command *com)
 set up a flash connection, associate with stream, called by command-handler for command "flash-app" More...
 
void flush (struct stream *stream)
 send remaining data to consumer (might be < packetsize!) More...
 
int forward_packet (struct command *com)
 a command is forwarded to target based on our hostroutes More...
 
void forward_radio (struct command *com)
 
void free_command (struct command *com)
 free a command More...
 
void free_commands (int index)
 free commands by index (-1 for all) More...
 
const char * get_arg (const struct command *com, int index)
 given an argument by index[0..n], will return a pointer to the bytearray (excluding the fieldtype) this is compatibility only, use get_arg_new() instead the argument may contain NUL bytes - use get_arg_size() to determine its length More...
 
int get_arg_int_array (const struct command *com, const int index, int *result, const int arraysize)
 given a command and argument index, will attempt to parse the arg as array and return it array syntax is currently semi-comma delimited hex values returns the number of values parsed deprecated - use field arrays instead More...
 
const byte * get_arg_new (const struct command *com, int index)
 given an argument by index[0..n], will returns a pointer to it. This will include the fieldnumber and fieldtype the argument may contain NUL bytes - use get_arg_size() to determine its length More...
 
int get_arg_size (const struct command *com, int index)
 given an argument by index [0..n], will returns the size of the value in bytes. for a string/array it is the size of the array. for a uint8_t it is 1 and for uint16_t it is 2... More...
 
int get_arg_size_inmem (const struct command *com, int index)
 given an argument by index [0..n], will returns the number in bytes this argument takes up in memory. for a string/array it is the fieldnum(1 byte) + fieldtype(1 byte) + arraylen(1 byte) + size of the array + nul-terminator(1byte) for a uint8_t it is 3 (fieldnum+fieldtype+1bytevalue) for a uint16_t it is 4 (fieldnum+fieldtype+2bytevalue) More...
 
void get_config_flags (struct command *com)
 get config flags More...
 
struct commandget_data_reply (struct command *com)
 allocates and initializes a packet to be send as "data" to the command typically you'd add some data to it and pass it to send_command(). after send_command() you'll need to free it More...
 
int get_esp8266_usart_mode ()
 
int get_esp_reboot_ctr ()
 
byte get_hops_to_server ()
 how many hops to the server? More...
 
struct mpmget_mpm ()
 
long get_my_node_id ()
 get the id of my node More...
 
int get_outbound_command_count_important ()
 return number of commands to be delivered (apart from announce/noop) More...
 
byte get_routing_debug ()
 
struct sensorruntimeget_runtime (int idx)
 
struct userapp_infoget_user_app ()
 
void getcloudtoken (struct command *com)
 get the opaque cloud token More...
 
void getpubkey (struct command *com)
 request the public key of this module More...
 
byte got_new_packet (struct command *com, uint8_t signal_indicator)
 stack received a new packet (signal indicator is a 0-255 byte value, interface specific) More...
 
void init_command_handler ()
 resets the command handler More...
 
void init_powersavething (struct powersavething *pst)
 
int internal_ti1101_init (struct network_context *onctx)
 
int invoke_on_command_received (struct command *com)
 
void invoke_on_new_node (struct hostroute *host)
 
void invoke_start (int MCULIBHANDLE)
 
void invoke_stop ()
 
void invoke_user_loop ()
 
void iplog (const char *format,...)
 log something to a remote node More...
 
void irq_metric_counter (int pin)
 
int is_command_valid (struct command *com)
 
int is_device_online (int device)
 return 1 if the specified device is online and routing More...
 
int is_last_ip_valid ()
 return true if IP is set and valid More...
 
int is_packet_for_us (struct command *com)
 check if a command needs to be routed More...
 
int is_stack (void *adr)
 
void led_blink (LED_USAGE_TYPE lut, uint32_t colour, uint8_t brightness, uint32_t on, uint32_t off)
 will keep blinking until told otherwise will repeat endlessly. More...
 
void led_blink_flags (LED_USAGE_TYPE lut, uint32_t colour, uint8_t brightness, uint32_t on, uint32_t off, uint32_t flags)
 
void led_flash (LED_USAGE_TYPE lut, uint32_t colour, uint32_t duration)
 will flash led once More...
 
void led_indicate (LED_INDICATOR a)
 
void led_init ()
 
void led_loop ()
 
void led_off (LED_USAGE_TYPE lut)
 
void led_print_status ()
 
void led_set_machine_managed ()
 
void led_set_user_managed ()
 
void led_set_wifi_managed ()
 
void list_modules (struct command *com)
 we received a list-modules command More...
 
void logging_event_loop ()
 sends current buffer and empties it More...
 
void logging_init ()
 initialise logging. logging is disabled after calling this function More...
 
void logging_off ()
 disable logging and logging processing. guarantees that no buffers are used for logging More...
 
void logging_on ()
 enable logging and logging processing. buffers are used for logging More...
 
void logging_set_node (long nodeid)
 log to a given node. Usually this would be an app or a server More...
 
void mark_last_in_use (struct powersavething *pst)
 
void micro_strobe (struct command *com)
 do a nano strobe More...
 
void mpm_free (void *mem)
 
void * mpm_reserve (int bytes)
 
void multi_mem_init ()
 called very early on, even before printf works More...
 
const char * namedarg (struct command *com, const char *name)
 get a named arg (key-value pair) or NULL More...
 
int namedarg_uint16 (struct command *com, const char *name, uint16_t *value)
 get a named arg (key-value pair), parsed as integer. result in "value". if return value == 0 , it was parsed, otherwise error code More...
 
int namedarg_uint32 (struct command *com, const char *name, uint32_t *value)
 get a named arg (key-value pair), parsed as integer. result in "value". if return value == 0 , it was parsed, otherwise error code More...
 
void node_to_str (long l, char *buf)
 
int on_command_received (struct command *com)
 this is called for each command we receive More...
 
void on_new_node (struct hostroute *host)
 called when and if a new node is detected. this may be used, to, for example to activate when a route to the cloud becomes available More...
 
int onewire_init (byte idx)
 
int onewire_reading_size (byte idx)
 
int onewire_run (byte idx, byte *error)
 
void packet_buf_init (const int num)
 initialize (reset, clear) a given buffer More...
 
byte * packet_getbuf (const int num)
 get pointer to the contents of the buffer More...
 
int packet_getbytesinbuf (const int num)
 count bytes in the buffer More...
 
void packet_init ()
 initialize (reset, clear) all buffers More...
 
int packet_isvalid (const int num)
 initialize (reset, clear) a given buffer More...
 
void packet_mark_valid (const int num)
 mark this buffer as containing a valid packet More...
 
int packet_put_byte (const int num, const byte b)
 add a byte to a buffer More...
 
void pin_pwm (MCULIB_HANDLE handle, int pin, uint32_t state, int flags)
 
void power_main_loop ()
 
int power_set_connectivity (struct power_state *ps, int turnon)
 
void power_set_speed (int speed)
 
void pretty_node_to_str (long l, char *buf)
 
void print_boot_info ()
 print startup information More...
 
void print_esp_core_info ()
 
void print_node_id (long l)
 
void print_outbound_queue ()
 
void print_pkt_state_update (int subsystem, int code, uint8_t d1, uint8_t d2)
 
void print_program_status ()
 
void print_pwm_state ()
 
void print_stream_info ()
 print summary of current streams to console More...
 
void printHelp ()
 
void process_command (struct command *com)
 command is parsed, now execute it More...
 
void process_command_queue ()
 this gets called when we got some cpu cycles spare we then send out commands and timeout other commands and so on More...
 
int process_queue_reply (struct command *ack)
 process a reply More...
 
void process_strobe_command (struct command *com)
 
void process_terminal_input ()
 
int query_onewire (struct onewire_hwdef *hw, byte *error)
 
void queue_init ()
 
int received_radio_get_config (struct command *com)
 called when we received radio_get_config command sends back an answer with the current radio config More...
 
int received_radio_set_config (struct command *com)
 called when we received radio_set_config command modified the current radio config More...
 
void remove_stale_routes ()
 "old" routes are being removed this is the route garbage collector More...
 
void request_route (long nodeid)
 send an arp request (equivalent) More...
 
int routing_count_nodes ()
 determine number of nodes known More...
 
void routing_error (struct command *com, int errorcode)
 
void routing_event_loop ()
 
struct hostrouterouting_find_empty_slot ()
 finds an empty slot in our routing entry list More...
 
struct hostrouterouting_find_host (const long nodeid)
 find route to host or NULL if none known More...
 
struct hostrouterouting_find_route (const long nodeid, const byte sourcedev)
 find specific hostroute to target or NULL if none known special case, if we ask for a route to server, we get any intermediary routes which announce themselves to have a connection a server More...
 
struct hostrouterouting_get_node_by_index (const int index)
 finds a nodeid by index. [0...n] More...
 
void routing_init ()
 called when we power-up More...
 
void routing_print_table ()
 print routing table More...
 
void routing_request_reply (const struct command *com)
 we call this when we receive a reply to a routing request this adds or updates a new route More...
 
void sc_fancy_allocator_init ()
 
void sc_free (void *ptr)
 
void * sc_realloc (void *ptr, size_t size)
 
int send_command (struct command *com)
 send a command to another module (or broadcast) More...
 
int send_command_fw_info (struct command *com, int err)
 send a reply to a command More...
 
int send_command_one_arg (int command, long target, const byte *arg1, int arg1len)
 helper function to quickly and easily send a command somewhere return 0 if ok, else errorcode More...
 
int send_command_quietly (struct command *com)
 
int send_command_reply (struct command *com, byte flags)
 send a reply to a command More...
 
int send_command_reply_with_args (struct command *com, byte flags, const char *format,...)
 send a reply to a command More...
 
int send_data (struct command *com, const char *format,...)
 send the format string as data in response to command "com" More...
 
void send_routing_update_now ()
 
int send_user_app_status ()
 
void sensor_activation (struct sensorruntime *sr, int activation)
 
void sensor_com_config (struct command *com)
 
void sensor_com_list (struct command *com)
 
void sensor_deregister (struct sensordev *sensor)
 
void sensor_info ()
 
int sensor_loop ()
 called periodically. this will either query sensors when they are due or will set the isdue flag for them to be picked up during IRQ returns true if new sensor data needs to be sent More...
 
void sensor_probe ()
 
struct sensordevsensor_register (struct sensordev *sensor)
 register a sensor, e.g. from userhook. The sensordev struct is COPIED, so it may be reused by the caller. the RETURN value is a pointer to the new sensordev, or NULL More...
 
void sensor_run_str (const char *str)
 
int sensor_submit_request (const long nodeid, int idx, const int readmillis, const int submitsec, const int max_values)
 
int sensor_update_config (const long nodeid, int idx, const int readmillis, const int submitsec, const int max_values)
 
void sensors_init ()
 initialize sensors, runtime, config, powerup each sensor in turn etc.. More...
 
uint8_t sensors_inited ()
 
void sensors_newstyle ()
 enable new-style sensors (and disable old) More...
 
void sensors_off ()
 disable sensors More...
 
void serialirq (int port, byte b) __attribute__((no_instrument_function))
 
void set_config_flag (struct command *com)
 set a single config flag More...
 
void set_esp8266_debug (byte b)
 
void set_esp8266_usart_mode (int i)
 
void set_forward_debug (byte b)
 
void set_in_app (uint8_t a)
 
void set_logging (struct command *com)
 
int set_mcu_power_mode (int state)
 
void set_new_node_id (char *nodetxt)
 
void set_routing_debug (byte b)
 
void setcloudtoken (struct command *com)
 set a token to connect to the cloud More...
 
void setdac (struct command *com)
 
void setpin (struct command *com)
 
int start (int mculib_handle, struct sc_firmware_api *uapi)
 this is called when the board powers up More...
 
void start_strobe (int relay, int ton, int toff, int repeat)
 
void start_wifi_scan ()
 
void stop ()
 
int stream_associate (int fd, const struct consumerinfo *ci, byte *buf, int bufsize, int packetsize)
 associate a stream with a consumer. return 0 if ok otherwise errorcode More...
 
void stream_disable ()
 disable all stream handling More...
 
void stream_enable ()
 enable all stream handling (default) More...
 
void stream_init ()
 
void stream_loop ()
 called periodically, checks for stale streams and/or hung ones More...
 
void stream_seterror (int streamfd, const char *format,...)
 
void streamdata (struct command *com)
 called when we receive a stream data packet TODO: this is a really simplistic, memory-consumption optimized algorithm. it currently discards packets which are out-of-order and keeps requesting the next packet in order. Possible optimisations: More...
 
void streamsetup (struct command *com)
 called when we receive a stream setup packet More...
 
int ti1101_compare_config ()
 check the config against the values in flash More...
 
int ti1101_cssns ()
 
void ti1101_disable ()
 
void ti1101_disable_irq (struct network_context *ctx)
 
void ti1101_enable_irq ()
 
void ti1101_event_loop_locked ()
 
void ti1101_failure ()
 
void ti1101_forward_radio (long node)
 forward all radio packets to this node mostly useful to debug and decode and sniff 3rd party protocols like door openers, thermostats etc... More...
 
byte ti1101_get_last_irq_error ()
 if we throw an error in the irq we cannot print it directly. save it and return it here. the irq_error is cleared by reading from it. More...
 
int ti1101_irqpin ()
 
int ti1101_is_enabled ()
 
int ti1101_lock ()
 lock, return 1 if ok, otherwise it is an error More...
 
int ti1101_loop (struct network_context *ctx)
 this is called in the main thread periodically More...
 
int ti1101_off ()
 diable processing of ti1101 commands More...
 
void ti1101_on ()
 enable processing of radio More...
 
void ti1101_print_config ()
 
void ti1101_print_status ()
 
byte ti1101_read_byte ()
 
int ti1101_read_version ()
 
void ti1101_receive_loop ()
 
void ti1101_rx ()
 
void ti1101_set_debug (byte b)
 set debug mode of ti1101 More...
 
int ti1101_spiport ()
 
int ti1101_transmit (struct network_context *nctx, const byte *data, uint16_t num_bytes)
 
int ti1101_tx ()
 
void ti1101_unlock ()
 
int update_all_runtimes ()
 update runtimes (recalculate buffer positions). return 0 if ok (5 otherwise) More...
 
int user_app_checksum_valid ()
 
void user_app_control (struct command *com)
 
void user_app_disable ()
 
void user_app_enable ()
 
void user_app_exe_init ()
 
int user_app_executable ()
 
int user_app_info (struct command *com)
 
int user_app_is_enabled ()
 
int user_app_is_valid ()
 
void user_app_reset_state ()
 
void user_loop ()
 this is called frequently, but with no timing guarantees. essentially, it's called in the "idle-loop" of the mcu More...
 
int user_serial_callback (int portnum, int byte)
 
int userapp_checksum_valid (void *baseadr)
 
void wifi_info (struct command *com)
 get some information about our currentwifi connection More...
 
void wifi_new_creds (char *buf)
 
void wifi_send_data (const PACKET_TYPE type, const byte *buf, const int len)
 send a command via wifi More...
 
void wifi_update_completed ()
 
void wifi_update_progress (const uint8_t *buf)
 
void wifi_update_started ()
 
void wireless_callback_state_change (int newstate, int oldstate)
 
int write_char_to_console (char b)
 
int write_serial_char (int port, char b)
 
int write_serial_line (int port, const char *txt)
 
int write_serial_string (int port, const char *txt)
 

Variables

char _estack
 
char _Minimum_Stack_Size
 
int ack_ctr
 
uint32_t acm_byte_received
 
int attemptctr
 
const char * BAUD_CHANGE_INDICATOR = "NEW BAUDRATE: ["
 
uint8_t brightness
 
byte buf [260]
 
byte buf [300]
 
struct espbuf bufs [7]
 
pkt_callback callback
 
uint32_t colour
 
struct commandcommand
 
const char *const command_names []
 
struct ringbuffer console_ringbuffer
 
uint8_t device
 
struct ringbuffer esp_ringbuffer
 
char esptmpbuf [128]
 
struct leddef extled = { .pins = { 7, 110, 111 }, .timers = { 2, 1, 1 } }
 
int fd
 
const struct consumerinfo flashconsumerinfo = { &flash_app_consumer, &flash_app_close }
 
struct hal_workspace hal
 
uint8_t hops_to_server
 
long host
 
uint8_t hosttype
 see https://www.singingcat.net?linkid=routing More...
 
struct leddef intled = { .pins = { 106, 107, 108 }, .timers = { 3, 3, 3 } }
 
long last_attempt
 
struct ipv4address lastip
 
long lastseen
 
byte lora_on
 
struct ledcolour machinecolour
 
int max_values
 
int MCULIBHANDLE
 
long nexthop
 here the nodeif of the intermediary hop (the proxy) More...
 
uint32_t off
 
uint32_t on
 
int order
 
struct cnw_packetbuf packetbuffer1
 
uint32_t permaramadr
 
uint8_t pin
 
int pins [3]
 
struct power_state prev_state
 
uint8_t pwm
 
volatile uint32_t * r_adr = (volatile uint32_t *)0x40020810
 
char rbuf [10]
 
int readmillis
 
char sbuf [10]
 
const struct sensordevsensor
 
struct sensordev sensors []
 list of sensors... More...
 
uint8_t signal_indicator
 
int size
 
int size
 
uint32_t speed
 
const char * statetable []
 
struct stream streams [2]
 mgmt for streams (the more ram, the more simultanous streams we can handle More...
 
int submitsecs
 
long target
 
uint32_t target_pwm
 
char tbuf [10]
 
volatile byte ti1101_in_read_loop = 0
 
volatile byte ti1101_locked = 0
 
byte ti1101_on
 
int timers [3]
 
int tn
 
void * UMM_MALLOC_CFG_HEAP_ADDR
 
uint32_t UMM_MALLOC_CFG_HEAP_SIZE
 
struct userapp_info userapp_vector
 
struct ledcolour usercolour
 
uint32_t value
 
byte wifi_on
 
long wifi_state_since = 0
 
long wifi_state_since
 
volatile uint32_t * wr_adr = (volatile uint32_t *)0x40020814
 

Detailed Description

Macro Definition Documentation

◆ AT_COMMAND_OK

#define AT_COMMAND_OK   2

baudrate [0=9600,1=19200,2=38400,3=57600,4=115200,5=230400,6=460800,7=921600,8=74880]

Definition at line 61 of file esp8266.c.

◆ AT_COMMAND_TIMEOUT

#define AT_COMMAND_TIMEOUT   7

Definition at line 62 of file esp8266.c.

◆ BROADCAST

#define BROADCAST   0xFFFFFFFF

Definition at line 17 of file routing.h.

◆ CHECK_TI1101_FAILURE

#define CHECK_TI1101_FAILURE   if (ti1101_failed) { ti1101_failure(); return; }

Definition at line 72 of file ti1101.c.

◆ CHECK_TI1101_FAILURE_S

#define CHECK_TI1101_FAILURE_S   if (ti1101_failed) { ti1101_failure(); printf("TI1101 failed\r\n"); return; }

Definition at line 73 of file ti1101.c.

◆ CHECK_TI1101_FAILURE_V

#define CHECK_TI1101_FAILURE_V   if (ti1101_failed) { ti1101_failure(); return 0; }

Definition at line 74 of file ti1101.c.

◆ CNWDEBUGCOM

#define CNWDEBUGCOM (   a,
  ... 
)    noop()

Definition at line 31 of file command-parser.c.

◆ COM_QUEUE_SIZE

#define COM_QUEUE_SIZE   80

Definition at line 54 of file queue.c.

◆ COMMAND_AGE_BEFORE_GC

#define COMMAND_AGE_BEFORE_GC   120

maximum amount of time a packet may remain allocated

  • any packet that was allocated longer than this amount of seconds ago is liable to be removed by the command allocator if it needs to satisfy new requests. theory goes that there should never be a command outstanding for a long time. either it goes through to the recipient within a few seconds or it does not. Saying that, we set it fairly high (default: 2 minutes) so to allow for some leeway it is mostly intented to copy better if developers create memory leaks

Definition at line 78 of file queue.c.

◆ command_names_size

#define command_names_size   60

Definition at line 29 of file command-parser.c.

◆ ESP8266_AFTER_BOOT_DEFAULT_BAUDRATE

#define ESP8266_AFTER_BOOT_DEFAULT_BAUDRATE   9600

Definition at line 55 of file esp8266.c.

◆ ESPMODE_ISAP

#define ESPMODE_ISAP   1

Definition at line 53 of file esp8266.c.

◆ HOSTROUTE_ENTRIES

#define HOSTROUTE_ENTRIES   40

Definition at line 39 of file routing.c.

◆ isNewStyleEnabled

#define isNewStyleEnabled   (sensors_enabled & (1 << 1))

Definition at line 110 of file sensor.c.

◆ isOldStyleEnabled

#define isOldStyleEnabled   (sensors_enabled & (1 << 0))

Definition at line 109 of file sensor.c.

◆ isProbing

#define isProbing   (sensors_enabled & (1 << 2))

Definition at line 111 of file sensor.c.

◆ LED_TIMER_FREQUENCY

#define LED_TIMER_FREQUENCY   130

Definition at line 17 of file led.c.

◆ MAX_ROUTE_AGE_SECONDS

#define MAX_ROUTE_AGE_SECONDS   600

any route that has not been used or seen for longer than this is subject to removal (the garbage collector)

Definition at line 46 of file routing.c.

◆ MAX_SECS_BEFORE_DELAYED_START

#define MAX_SECS_BEFORE_DELAYED_START   10

Definition at line 54 of file main.c.

◆ MAX_SECS_BETWEEN_LOOP_SAMPLES

#define MAX_SECS_BETWEEN_LOOP_SAMPLES   5

Definition at line 57 of file main.c.

◆ MAX_SECS_BETWEEN_RADIO_BROADCASTS

#define MAX_SECS_BETWEEN_RADIO_BROADCASTS   300

Definition at line 56 of file main.c.

◆ MAX_SECS_BETWEEN_STOP_WARNING

#define MAX_SECS_BETWEEN_STOP_WARNING   10

Definition at line 55 of file main.c.

◆ MAX_SECS_BETWEEN_WIFI_DETECT

#define MAX_SECS_BETWEEN_WIFI_DETECT   600

how often to check if a wifichip is attached

Definition at line 66 of file esp8266.c.

◆ MCULIB_USERAPP_HANDLE

#define MCULIB_USERAPP_HANDLE   7

Definition at line 142 of file user_app_exe.c.

◆ MEMAREA_SIZE

#define MEMAREA_SIZE   4096

Definition at line 72 of file multiram.c.

◆ ONEWIRE_INTERVAL

#define ONEWIRE_INTERVAL   600

Definition at line 24 of file onewire.c.

◆ SECONDS_BEFORE_ATTEMPTING_TO_RECONNECT

#define SECONDS_BEFORE_ATTEMPTING_TO_RECONNECT   600

if we fail to log in to [ssid], we fallback to 'singingcat'. If so, how often shall we retry to connect to [ssid]

Do not make this too short - it is annoying if devices attempt to configure it and get kicked out because we attempt to reconnect to a non-existing accesspoint

Definition at line 84 of file esp8266.c.

◆ SECONDS_BEFORE_ESP_FAIL

#define SECONDS_BEFORE_ESP_FAIL   30

if esp8266 fails to provide a valid ip after this time: reinitialise

Definition at line 72 of file esp8266.c.

◆ SECONDS_BEFORE_ESP_RESET_FAIL

#define SECONDS_BEFORE_ESP_RESET_FAIL   30

after reset, how long before failure detection starts

Definition at line 77 of file esp8266.c.

◆ SECS_AFTER_BOOT_BEFORE_POWERSAFE

#define SECS_AFTER_BOOT_BEFORE_POWERSAFE   120

Definition at line 20 of file powersave.c.

◆ SECS_AFTER_LASTCOM_BEFORE_POWERSAFE

#define SECS_AFTER_LASTCOM_BEFORE_POWERSAFE   3

Definition at line 24 of file powersave.c.

◆ SECS_AFTER_WAKE_BEFORE_POWERSAFE

#define SECS_AFTER_WAKE_BEFORE_POWERSAFE   10

Definition at line 21 of file powersave.c.

◆ SECS_BETWEEN_CLOUD_PROBES

#define SECS_BETWEEN_CLOUD_PROBES   300

how often to probe the cloud connection

Note: make sure it's less than route garbage collector (routing.c)

Definition at line 44 of file esp8266_cloud.c.

◆ SECS_UNTIL_CONNECTION_DEAD

#define SECS_UNTIL_CONNECTION_DEAD   (SECS_BETWEEN_CLOUD_PROBES * 4)

if we don't receive an answer for this long (in seconds) assume connection is dead

Definition at line 48 of file esp8266_cloud.c.

◆ SENSOR_FLAG_ACTIVATED

#define SENSOR_FLAG_ACTIVATED   4

Definition at line 73 of file sensor.c.

◆ SENSOR_FLAG_DETECTED

#define SENSOR_FLAG_DETECTED   2

Definition at line 70 of file sensor.c.

◆ SENSOR_FLAG_ENABLED

#define SENSOR_FLAG_ENABLED   0

Definition at line 68 of file sensor.c.

◆ SENSOR_FLAG_ISDUE

#define SENSOR_FLAG_ISDUE   1

Definition at line 69 of file sensor.c.

◆ SENSOR_FLAG_PROBED

#define SENSOR_FLAG_PROBED   3

Definition at line 71 of file sensor.c.

◆ SENSOR_TIMER

#define SENSOR_TIMER   4

timer to use

Definition at line 88 of file sensor.c.

◆ SENSOR_TIMER_FREQUENCY

#define SENSOR_TIMER_FREQUENCY   1000

frequency our timer runs on

Definition at line 84 of file sensor.c.

◆ TI1101_BURST

#define TI1101_BURST   0x40

Definition at line 15 of file ti1101.c.

◆ TI1101_READ

#define TI1101_READ   0x80

Definition at line 16 of file ti1101.c.

Typedef Documentation

◆ _espbuf

typedef struct espbuf _espbuf

}garbageend and you get: PKT_TYPE{a,1,00000001,19F05795,19F05795,1,3,noop} Explanation:

  1. The outer brackets have been stripped
  2. the inner brackets have been unescaped.
  3. the not-in-package ("garbage*") has been ignored.

Note to developers: esp8266_add_byte is called from within the serial interrupt, please take great care when modifying this code to avoid race-conditions. The order of instructions is crucial and delicate! Keep each path short!

◆ _hostroute

typedef struct hostroute _hostroute

information about a single host

Function Documentation

◆ _command_add_encoded_arg()

int _command_add_encoded_arg ( struct command com,
byte *  buf 
)

Definition at line 123 of file command-parser.c.

◆ adr_create_new_node_id()

long adr_create_new_node_id ( )

Definition at line 20 of file addressing.c.

◆ adr_isvalid()

int adr_isvalid ( long  a)

Definition at line 8 of file addressing.c.

◆ all_sensors_probed()

int all_sensors_probed ( )

Definition at line 754 of file sensor.c.

◆ alloc_command()

struct command * alloc_command ( )

allocate a free command

  • this must be freed with free_command
Return values
longmy node id

Definition at line 173 of file queue.c.

Referenced by get_config_flags(), get_data_reply(), getcloudtoken(), list_modules(), received_radio_get_config(), request_route(), send_command_fw_info(), send_command_one_arg(), send_command_reply(), send_command_reply_with_args(), and wifi_info().

◆ alloc_command_with_minfree()

struct command * alloc_command_with_minfree ( int  minfree)

Definition at line 106 of file queue.c.

◆ alloc_stream()

struct stream * alloc_stream ( )

find a free stream struct, alloc an fd and return struct

Definition at line 156 of file streams.c.

◆ app_main()

int app_main ( void  )

start of app after system reset

Definition at line 839 of file main.c.

◆ app_main_no_return()

void app_main_no_return ( )

Definition at line 520 of file main.c.

◆ ascii_commandstring_to_num()

int ascii_commandstring_to_num ( const byte *  buf,
int  size,
int *const  newpos 
)

match a string to a command num.

command string must be terminated by 0 or '}' or ',' upon return the int variable pointed to by newpos will point to the first character which is not part of the command name. (usually 0, '}' or ',')

Definition at line 208 of file command-parser.c.

◆ bridge_packet()

void bridge_packet ( struct command com)

Definition at line 72 of file routing.c.

◆ calc_power_mode()

void calc_power_mode ( )

Definition at line 103 of file powersave.c.

◆ cat_send_local_instruction()

void cat_send_local_instruction ( const PACKET_TYPE  type,
const uint8_t *  buf,
const int  len 
)

send a packet to the esp8266 wifi chip

type is, for example, INSTRUCTION_DOWNLOAD_UPDATE or INSTRUCTION_RECONNECT_CLOUD

Definition at line 1343 of file esp8266.c.

◆ check_close()

void check_close ( struct stream stream)

check if closing flash ist set and we received all the data up to close packet if, flush and close stream

Definition at line 425 of file streams.c.

References flush().

◆ check_strobe()

void check_strobe ( )

Definition at line 689 of file command-handler.c.

◆ clear_outbound_queue()

void clear_outbound_queue ( )

clear the outbound queue any commands within the queue are silently discarded

Definition at line 87 of file queue.c.

◆ close_stream()

void close_stream ( int  fd,
int  reason 
)

Definition at line 204 of file streams.c.

◆ command_add_arg()

void command_add_arg ( struct command com,
const char *  format,
  ... 
)

adds an arg to a partially initialised command structure

Definition at line 130 of file command-parser.c.

References command_add_varg().

Referenced by get_config_flags(), getcloudtoken(), list_modules(), request_route(), and wifi_info().

◆ command_add_binary_arg()

int command_add_binary_arg ( struct command com,
const int  len,
const byte *  srcbuf 
)

adds a binary parameter to command returns 0 if ok otherwise errorcode

Definition at line 167 of file command-parser.c.

Referenced by received_radio_get_config(), and send_command_one_arg().

◆ command_add_varg()

void command_add_varg ( struct command com,
const char *  format,
va_list  args 
)

adds a varg list of parameters to a command

Definition at line 140 of file command-parser.c.

Referenced by command_add_arg(), send_command_reply_with_args(), and send_data().

◆ command_calc_checksum()

byte command_calc_checksum ( struct command com)

Definition at line 740 of file command-parser.c.

◆ command_decode_ascii()

int command_decode_ascii ( struct command com,
const byte *  buf,
int  size,
int  version 
)

Definition at line 346 of file command-parser.c.

◆ command_decode_binary()

int command_decode_binary ( struct command com,
const byte *  buf,
int  size 
)

Definition at line 337 of file command-parser.c.

◆ command_encode_ascii()

int command_encode_ascii ( struct command com,
int  bufsize,
char *  buf 
)

encode a command to an ascii blob properly surrounded by '{' and '}' and escaped returns length if ok or <0 if error

Definition at line 573 of file command-parser.c.

◆ command_get_name()

const char * command_get_name ( int  num)

given a command number returns its name

Definition at line 113 of file command-parser.c.

◆ command_get_source_name()

char * command_get_source_name ( byte  sourcedev)

returns a human readable text identifying a source device

Definition at line 240 of file command-parser.c.

◆ command_init()

void command_init ( struct command com)

initialize a command structure with default values

Definition at line 660 of file command-parser.c.

References command::com.

Referenced by get_data_reply(), list_modules(), received_radio_get_config(), send_command_fw_info(), send_command_reply(), and send_command_reply_with_args().

◆ command_parse()

struct command * command_parse ( const byte *  buf,
int  size 
)

Definition at line 514 of file command-parser.c.

◆ command_print()

void command_print ( struct command com)

prints a command in human readable format to serial console

Definition at line 300 of file command-parser.c.

Referenced by process_command().

◆ command_start()

void command_start ( )

initialization for command parser

Definition at line 107 of file command-parser.c.

◆ console_add_byte()

void console_add_byte ( uint8_t  b)

Definition at line 486 of file main.c.

◆ console_get_byte()

uint16_t console_get_byte ( )

Definition at line 489 of file main.c.

◆ console_get_line()

int console_get_line ( char *  outbuf,
int  outbufsize 
)

Definition at line 483 of file main.c.

◆ console_reset()

void console_reset ( )

Definition at line 492 of file main.c.

◆ constants()

struct consts * constants ( )

Definition at line 15 of file constants.c.

◆ constants_init()

int constants_init ( )

Definition at line 26 of file constants.c.

◆ constants_print()

void constants_print ( )

Definition at line 52 of file constants.c.

◆ constants_validate()

void constants_validate ( )

Definition at line 43 of file constants.c.

◆ count_open_streams()

int count_open_streams ( )

count number of open streams

Definition at line 624 of file streams.c.

◆ create_new_node_id()

void create_new_node_id ( )

Definition at line 76 of file main.c.

◆ dac_timer()

void dac_timer ( )

Definition at line 664 of file command-handler.c.

◆ decisionname()

const char * decisionname ( int  decision)

Definition at line 185 of file routing.c.

◆ decode_esp_packet_init()

void decode_esp_packet_init ( )

reset decode to "factory defaults"

Definition at line 50 of file decode_esp_packet.c.

◆ decode_marcstate()

const char * decode_marcstate ( int  state)

Definition at line 676 of file ti1101.c.

◆ deliver_command()

int deliver_command ( struct command com,
pkt_callback  cb 
)

deliver a command to a module

  • this sends the command to a module using send_command. the command will not be sent immediately but queued. this will deliver the command several times until we receive an ACK from the receiver. the packet buffer becomes the responsibility of this function. do not free the buf after calling this or there will be dragons. The buf will be freed by the dequeuing mechanism. it returns 0 if the delivery request has been accepted or an errorcode if for some reason the delivery cannot begin. the callback might be NULL if you just want best-effort delivery but no notification.

it is entirely possible that the callback will be called multiple times, for example at broadcasts

the callback will be called either way, even if no answer is received.

Definition at line 651 of file queue.c.

Referenced by get_config_flags(), getcloudtoken(), send_command_fw_info(), send_command_one_arg(), send_command_reply(), and send_command_reply_with_args().

◆ error_com()

void error_com ( void *  com)

Definition at line 866 of file command-parser.c.

◆ esp8266_add_ap()

void esp8266_add_ap ( const char *  ssid,
const char *  pw 
)

add an ap to the list of known ap

Definition at line 424 of file esp8266.c.

◆ esp8266_add_byte()

int esp8266_add_byte ( byte  b)

feed this with one byte at a time

will return number of bytes in buf if a complete packet was processed returns 0 otherwise

Definition at line 97 of file decode_esp_packet.c.

◆ esp8266_bridge()

void esp8266_bridge ( )

bridge debug serialport and esp8266 (e.g. "wifidebug")

Definition at line 791 of file esp8266.c.

Referenced by esp8266_wififlash_bridge().

◆ esp8266_cloud_connection_failed()

void esp8266_cloud_connection_failed ( )

called if the cloud connection failed

Definition at line 1661 of file esp8266.c.

◆ esp8266_cloud_loop()

void esp8266_cloud_loop ( )

called from esp8266 event loop if we are connected

Definition at line 123 of file esp8266_cloud.c.

◆ esp8266_decoder_print_info()

void esp8266_decoder_print_info ( )

Definition at line 250 of file decode_esp_packet.c.

◆ esp8266_disable()

void esp8266_disable ( )

disable the esp8266 (switch it off)

Definition at line 1446 of file esp8266.c.

◆ esp8266_dodebug()

void esp8266_dodebug ( const char *  paras)

Definition at line 358 of file esp8266.c.

◆ esp8266_enable()

void esp8266_enable ( )

enable the esp8266 (switch it on)

Definition at line 1442 of file esp8266.c.

◆ esp8266_event_loop()

void esp8266_event_loop ( )

Definition at line 1549 of file esp8266.c.

◆ esp8266_get_buf()

byte * esp8266_get_buf ( )

get the buffer

Definition at line 222 of file decode_esp_packet.c.

◆ esp8266_get_chip()

int esp8266_get_chip ( )

Definition at line 1178 of file esp8266.c.

◆ esp8266_get_current_ip()

struct ipv4address * esp8266_get_current_ip ( )

return last ip (null if none)

Definition at line 1229 of file esp8266.c.

Referenced by wifi_info().

◆ esp8266_get_firmware_base()

uint64_t esp8266_get_firmware_base ( )

Definition at line 1187 of file esp8266.c.

◆ esp8266_get_firmware_repo()

int esp8266_get_firmware_repo ( )

Definition at line 1184 of file esp8266.c.

◆ esp8266_get_firmware_version()

int esp8266_get_firmware_version ( )

Definition at line 1181 of file esp8266.c.

◆ esp8266_get_invalid_commands()

long esp8266_get_invalid_commands ( )

Definition at line 199 of file esp8266.c.

◆ esp8266_get_operational_baudrate()

int esp8266_get_operational_baudrate ( )

Definition at line 217 of file esp8266.c.

◆ esp8266_get_time_of_last_ip()

long esp8266_get_time_of_last_ip ( )

Definition at line 1235 of file esp8266.c.

◆ esp8266_get_valid_commands()

long esp8266_get_valid_commands ( )

Definition at line 196 of file esp8266.c.

◆ esp8266_got_packet()

void esp8266_got_packet ( const byte *  buf,
int  size 
)
                    packet from esp received ********************************

1) bytes are added to esp8266_add_byte in "decode_esp" from the IRQ (see esp8266_read_byte_from_serialport). 2) the main loop periodically checks if "decode_esp" reports a full packet, if so, it calls this this must be enclosed in '{}' buf -> PKT_COMMAND|PKT_IP_UDPATE or so

Definition at line 1069 of file esp8266.c.

◆ esp8266_is_accespoint()

int esp8266_is_accespoint ( )

returns !=0 if we are currently an accesspoint

Definition at line 583 of file esp8266.c.

◆ esp8266_is_enabled()

int esp8266_is_enabled ( )

Definition at line 1434 of file esp8266.c.

◆ esp8266_is_in_packet()

byte esp8266_is_in_packet ( )

returns 1 if currently parsing a packet

specifically: if it is within PKT_START and PKT_END byte

Definition at line 234 of file decode_esp_packet.c.

◆ esp8266_ota()

void esp8266_ota ( )

tell the esp to do an OTA

Definition at line 1328 of file esp8266.c.

◆ esp8266_packet_size()

int esp8266_packet_size ( )

returns 0 if no packet is in buf, otherwise returns size of packet in bytes

Definition at line 241 of file decode_esp_packet.c.

◆ esp8266_read_byte_from_serialport()

void esp8266_read_byte_from_serialport ( int  val)

this is called directly from the usart IRQ. be quick. and do not use printf()

Definition at line 1262 of file esp8266.c.

◆ esp8266_reset()

void esp8266_reset ( )

reset state machine and esp8266

Definition at line 387 of file esp8266.c.

◆ esp8266_reset_buf()

void esp8266_reset_buf ( )

reset buf, e.g. after packet was processed

This is more complicated than just resetting the pointers: we might have gathered extra bytes in-between detecting first command, processing it and calling reset_buf. So there might be extra bytes we now need to keep. This must be done in a way that does not interfere with IRQs from the serialport

what we do is this:

  1. if there's no extra bytes in the buf, we simple reset all pointers. end. otherwise:
  1. we copy the extra bytes to the beginning of the buf
  2. we reset the bytesinbuf-ptr, so that IRQ writes to new position
  3. we check if in-between 1&2 we received extra bytes, if so we copy them now

there is still a small racecondition though: If we receive one or more bytes after 1, including an end-of-packet, before we do 2, we miss those bytes. we detect a packet with odd data. we got to fix that in get_buf(); (TODO)

Definition at line 197 of file decode_esp_packet.c.

◆ esp8266_reset_command_validity_ctrs()

void esp8266_reset_command_validity_ctrs ( )

Definition at line 202 of file esp8266.c.

◆ esp8266_send_config()

void esp8266_send_config ( )

Definition at line 544 of file esp8266.c.

◆ esp8266_send_instructions()

void esp8266_send_instructions ( )

send our nodeid and other goodies to the esp8266 chip

Definition at line 1311 of file esp8266.c.

Referenced by setcloudtoken().

◆ esp8266_set_operational_baudrate()

void esp8266_set_operational_baudrate ( int  baudrate)

Definition at line 206 of file esp8266.c.

◆ esp8266_status_string()

char * esp8266_status_string ( )

returns a human readable status string of the wifi connection

Definition at line 859 of file esp8266.c.

◆ esp8266_test()

void esp8266_test ( )

run a low-level test, such as reset / flash mode etc..

Definition at line 256 of file esp8266.c.

◆ esp8266_wifi_scan()

void esp8266_wifi_scan ( struct command com)

Definition at line 1417 of file esp8266.c.

◆ esp8266_wififlash_bridge()

void esp8266_wififlash_bridge ( void  )

set esp8266 to flash mode, sync and then bridge ("startflash")

Definition at line 675 of file esp8266.c.

References esp8266_bridge().

◆ esp_cloud_activate()

void esp_cloud_activate ( )

activate the cloud.

if the cloud is activated, we maintain a connection. if not we track the esp8266 IP connections, but do not initiate a command via server. This is set/maintained by the esp8266.c state. not a user function!

Definition at line 137 of file esp8266_cloud.c.

◆ esp_cloud_answered()

void esp_cloud_answered ( struct command com,
struct command reply 
)

called on command timeout or reply

Definition at line 207 of file esp8266_cloud.c.

◆ esp_cloud_connect_state_string()

const char * esp_cloud_connect_state_string ( )

Definition at line 222 of file esp8266_cloud.c.

◆ esp_cloud_deactivate()

void esp_cloud_deactivate ( )

Definition at line 152 of file esp8266_cloud.c.

◆ esp_cloud_get_desired_server()

const char * esp_cloud_get_desired_server ( )

returns server we want to connect to

Definition at line 68 of file esp8266_cloud.c.

◆ esp_cloud_init()

void esp_cloud_init ( )

this resets the cloud state

Definition at line 57 of file esp8266_cloud.c.

◆ esp_cloud_is_activated()

byte esp_cloud_is_activated ( )

return 1 if cloud connection is activated

Definition at line 167 of file esp8266_cloud.c.

◆ esp_cloud_is_connected()

int esp_cloud_is_connected ( )

Definition at line 173 of file esp8266_cloud.c.

◆ esp_cloud_state_update()

void esp_cloud_state_update ( int  code,
int  data 
)

whenever the esp chip sends us an update about the cloud state this gets called by the event handler for the esp8266 (not in irq)

Definition at line 82 of file esp8266_cloud.c.

Referenced by print_pkt_state_update().

◆ esp_empty_ringbuffer()

void esp_empty_ringbuffer ( )

empties the ringbuffer.

  • the race-condition comes for free. unavoidable with the esp8266

Definition at line 592 of file esp8266.c.

◆ esp_get_last_pw()

const char * esp_get_last_pw ( )

Definition at line 1426 of file esp8266.c.

◆ esp_get_last_ssid()

const char * esp_get_last_ssid ( )

Definition at line 1429 of file esp8266.c.

◆ esp_get_mac()

int esp_get_mac ( char *  buf,
int  bufsize 
)

get the esp8266 mac address.

return 0 on success

Definition at line 931 of file esp8266.c.

◆ esp_info()

void esp_info ( )

Definition at line 234 of file esp8266_cloud.c.

◆ esp_init()

void esp_init ( )

call this ONCE before calling anything else

Definition at line 883 of file esp8266.c.

◆ esp_read_mac()

int esp_read_mac ( )

this actually READS the mac from the esp8266 (sync/flash stuff)

Definition at line 948 of file esp8266.c.

◆ factory_default()

void factory_default ( struct command com)

set the module back to factory default

Definition at line 223 of file command-handler.c.

◆ fets_init()

void fets_init ( )

Definition at line 28 of file fets.c.

◆ fets_loop()

void fets_loop ( )

Definition at line 146 of file fets.c.

◆ fets_set_com()

void fets_set_com ( struct command com)

Definition at line 178 of file fets.c.

◆ flagstostr()

void flagstostr ( char *  buf,
int  flags 
)

given a pointer to a buffer and command flags, it will fill the buffer with a human readable text describing the flags

Definition at line 264 of file command-parser.c.

◆ flash_app_close()

int flash_app_close ( int  fd,
int  reason 
)

Definition at line 66 of file flashapp.c.

◆ flash_app_consumer()

int flash_app_consumer ( int  streamfd,
byte *  b,
int  size 
)

called by stream whenever we got sufficient bytes (and only on full blocks!)

Definition at line 102 of file flashapp.c.

◆ flash_app_init()

int flash_app_init ( void *  base,
uint32_t  flags 
)

Definition at line 207 of file flashapp.c.

◆ flash_debug()

void flash_debug ( )

Definition at line 62 of file flashapp.c.

◆ flash_write()

int flash_write ( byte *  b,
void *  adr,
int  size 
)

unlock, erase, write, lock

Definition at line 157 of file flashapp.c.

◆ flashcom()

void flashcom ( struct command com)

set up a flash connection, associate with stream, called by command-handler for command "flash-app"

Definition at line 224 of file flashapp.c.

◆ flush()

void flush ( struct stream stream)

send remaining data to consumer (might be < packetsize!)

Definition at line 402 of file streams.c.

Referenced by check_close().

◆ forward_packet()

int forward_packet ( struct command com)

a command is forwarded to target based on our hostroutes

returns 0 if successfull, otherwise errorcode

Definition at line 31 of file forwarding.c.

References command::flags, and hostroute::host.

◆ forward_radio()

void forward_radio ( struct command com)

Definition at line 274 of file command-handler.c.

◆ free_command()

void free_command ( struct command com)

free a command

  • Return values
    longmy node id

Definition at line 200 of file queue.c.

Referenced by list_modules(), request_route(), and send_data().

◆ free_commands()

void free_commands ( int  index)

free commands by index (-1 for all)

Definition at line 181 of file queue.c.

◆ get_arg()

const char * get_arg ( const struct command com,
int  index 
)

given an argument by index[0..n], will return a pointer to the bytearray (excluding the fieldtype) this is compatibility only, use get_arg_new() instead the argument may contain NUL bytes - use get_arg_size() to determine its length

Definition at line 728 of file command-parser.c.

Referenced by micro_strobe(), namedarg(), process_command(), received_radio_set_config(), routing_request_reply(), set_config_flag(), and setcloudtoken().

◆ get_arg_int_array()

int get_arg_int_array ( const struct command com,
const int  index,
int *  result,
const int  arraysize 
)

given a command and argument index, will attempt to parse the arg as array and return it array syntax is currently semi-comma delimited hex values returns the number of values parsed deprecated - use field arrays instead

Definition at line 834 of file command-parser.c.

References command::com, get_arg_size(), and command::index.

◆ get_arg_new()

const byte * get_arg_new ( const struct command com,
int  index 
)

given an argument by index[0..n], will returns a pointer to it. This will include the fieldnumber and fieldtype the argument may contain NUL bytes - use get_arg_size() to determine its length

Definition at line 671 of file command-parser.c.

◆ get_arg_size()

int get_arg_size ( const struct command com,
int  index 
)

given an argument by index [0..n], will returns the size of the value in bytes. for a string/array it is the size of the array. for a uint8_t it is 1 and for uint16_t it is 2...

Definition at line 714 of file command-parser.c.

References command::com, and command::index.

Referenced by get_arg_int_array(), and received_radio_set_config().

◆ get_arg_size_inmem()

int get_arg_size_inmem ( const struct command com,
int  index 
)

given an argument by index [0..n], will returns the number in bytes this argument takes up in memory. for a string/array it is the fieldnum(1 byte) + fieldtype(1 byte) + arraylen(1 byte) + size of the array + nul-terminator(1byte) for a uint8_t it is 3 (fieldnum+fieldtype+1bytevalue) for a uint16_t it is 4 (fieldnum+fieldtype+2bytevalue)

Definition at line 700 of file command-parser.c.

◆ get_config_flags()

void get_config_flags ( struct command com)

◆ get_data_reply()

struct command * get_data_reply ( struct command com)

allocates and initializes a packet to be send as "data" to the command typically you'd add some data to it and pass it to send_command(). after send_command() you'll need to free it

Definition at line 271 of file queue.c.

References alloc_command(), command::com, command_init(), command::connid, command::encoding, command::flags, command::index, command::sourcedev, and command::target.

Referenced by send_data().

◆ get_esp8266_usart_mode()

int get_esp8266_usart_mode ( )

Definition at line 970 of file esp8266.c.

◆ get_esp_reboot_ctr()

int get_esp_reboot_ctr ( )

Definition at line 192 of file esp8266.c.

◆ get_hops_to_server()

byte get_hops_to_server ( )

how many hops to the server?

0=no route, 1 = direct connection, 2=one intermediary etc..

Definition at line 526 of file routing.c.

Referenced by routing_print_table().

◆ get_mpm()

struct mpm * get_mpm ( )

Definition at line 31 of file multiram.c.

◆ get_my_node_id()

long get_my_node_id ( )

get the id of my node

  • Return values
    longmy node id

Definition at line 238 of file command-handler.c.

◆ get_outbound_command_count_important()

int get_outbound_command_count_important ( )

return number of commands to be delivered (apart from announce/noop)

Definition at line 813 of file queue.c.

◆ get_routing_debug()

byte get_routing_debug ( )

Definition at line 95 of file routing.c.

◆ get_runtime()

struct sensorruntime * get_runtime ( int  idx)

Definition at line 540 of file sensor.c.

◆ get_user_app()

struct userapp_info * get_user_app ( )

Definition at line 194 of file user_app_exe.c.

◆ getcloudtoken()

void getcloudtoken ( struct command com)

◆ getpubkey()

void getpubkey ( struct command com)

request the public key of this module

Definition at line 417 of file command-handler.c.

References command::com, and send_command_reply().

◆ got_new_packet()

byte got_new_packet ( struct command com,
uint8_t  signal_indicator 
)

stack received a new packet (signal indicator is a 0-255 byte value, interface specific)

return: 0==packet was discarded 1==packet was forwarded 2==packet was bridged 3==packet was processed locally (via process_command())

Definition at line 111 of file routing.c.

◆ init_command_handler()

void init_command_handler ( )

resets the command handler

this must be called at least once when the firmware boots.

Definition at line 78 of file command-handler.c.

◆ init_powersavething()

void init_powersavething ( struct powersavething pst)

Definition at line 252 of file powersave.c.

◆ internal_ti1101_init()

int internal_ti1101_init ( struct network_context onctx)

Definition at line 144 of file ti1101.c.

◆ invoke_on_command_received()

int invoke_on_command_received ( struct command com)

Definition at line 325 of file user_app_exe.c.

◆ invoke_on_new_node()

void invoke_on_new_node ( struct hostroute host)

Definition at line 332 of file user_app_exe.c.

◆ invoke_start()

void invoke_start ( int  MCULIBHANDLE)

Definition at line 302 of file user_app_exe.c.

◆ invoke_stop()

void invoke_stop ( )

Definition at line 313 of file user_app_exe.c.

◆ invoke_user_loop()

void invoke_user_loop ( )

Definition at line 338 of file user_app_exe.c.

◆ iplog()

void iplog ( const char *  format,
  ... 
)

log something to a remote node

Definition at line 87 of file logging.c.

◆ irq_metric_counter()

void irq_metric_counter ( int  pin)

Definition at line 61 of file main.c.

◆ is_command_valid()

int is_command_valid ( struct command com)

Definition at line 857 of file command-parser.c.

◆ is_device_online()

int is_device_online ( int  device)

return 1 if the specified device is online and routing

Definition at line 63 of file routing.c.

◆ is_last_ip_valid()

int is_last_ip_valid ( )

return true if IP is set and valid

Definition at line 189 of file esp8266.c.

◆ is_packet_for_us()

int is_packet_for_us ( struct command com)

check if a command needs to be routed

we deal with all the stuff for the packet from here, unless it is a packet we should process. we return 1 if (and only if) the packet needs processing locally

Definition at line 120 of file command-handler.c.

Referenced by process_command().

◆ is_stack()

int is_stack ( void *  adr)

Definition at line 56 of file multiram.c.

◆ led_blink()

void led_blink ( LED_USAGE_TYPE  lut,
uint32_t  colour,
uint8_t  brightness,
uint32_t  on,
uint32_t  off 
)

will keep blinking until told otherwise will repeat endlessly.

Definition at line 288 of file led.c.

◆ led_blink_flags()

void led_blink_flags ( LED_USAGE_TYPE  lut,
uint32_t  colour,
uint8_t  brightness,
uint32_t  on,
uint32_t  off,
uint32_t  flags 
)

Definition at line 291 of file led.c.

◆ led_flash()

void led_flash ( LED_USAGE_TYPE  lut,
uint32_t  colour,
uint32_t  duration 
)

will flash led once

Definition at line 273 of file led.c.

◆ led_indicate()

void led_indicate ( LED_INDICATOR  a)

Definition at line 356 of file led.c.

◆ led_init()

void led_init ( )

Definition at line 222 of file led.c.

◆ led_loop()

void led_loop ( )

Definition at line 330 of file led.c.

◆ led_off()

void led_off ( LED_USAGE_TYPE  lut)

Definition at line 323 of file led.c.

◆ led_print_status()

void led_print_status ( )

Definition at line 314 of file led.c.

◆ led_set_machine_managed()

void led_set_machine_managed ( )

Definition at line 346 of file led.c.

◆ led_set_user_managed()

void led_set_user_managed ( )

Definition at line 349 of file led.c.

◆ led_set_wifi_managed()

void led_set_wifi_managed ( )

Definition at line 352 of file led.c.

◆ list_modules()

void list_modules ( struct command com)

◆ logging_event_loop()

void logging_event_loop ( )

sends current buffer and empties it

Definition at line 54 of file logging.c.

◆ logging_init()

void logging_init ( )

initialise logging. logging is disabled after calling this function

Definition at line 20 of file logging.c.

◆ logging_off()

void logging_off ( )

disable logging and logging processing. guarantees that no buffers are used for logging

Definition at line 34 of file logging.c.

◆ logging_on()

void logging_on ( )

enable logging and logging processing. buffers are used for logging

Definition at line 42 of file logging.c.

◆ logging_set_node()

void logging_set_node ( long  nodeid)

log to a given node. Usually this would be an app or a server

Definition at line 27 of file logging.c.

◆ mark_last_in_use()

void mark_last_in_use ( struct powersavething pst)

Definition at line 256 of file powersave.c.

◆ micro_strobe()

void micro_strobe ( struct command com)

do a nano strobe

Definition at line 197 of file command-handler.c.

References get_arg().

◆ mpm_free()

void mpm_free ( void *  mem)

unreserve bytes

Definition at line 48 of file multiram.c.

◆ mpm_reserve()

void * mpm_reserve ( int  bytes)

we reserve bytes from the command buffer (or other dynamic places) free it with mpm_free! (not yet implemented)

Definition at line 38 of file multiram.c.

◆ multi_mem_init()

void multi_mem_init ( )

called very early on, even before printf works

Definition at line 26 of file multiram.c.

◆ namedarg()

const char * namedarg ( struct command com,
const char *  name 
)

get a named arg (key-value pair) or NULL

Definition at line 787 of file command-parser.c.

References command::com, and get_arg().

Referenced by namedarg_uint16(), and namedarg_uint32().

◆ namedarg_uint16()

int namedarg_uint16 ( struct command com,
const char *  name,
uint16_t *  value 
)

get a named arg (key-value pair), parsed as integer. result in "value". if return value == 0 , it was parsed, otherwise error code

Definition at line 816 of file command-parser.c.

References command::com, and namedarg().

◆ namedarg_uint32()

int namedarg_uint32 ( struct command com,
const char *  name,
uint32_t *  value 
)

get a named arg (key-value pair), parsed as integer. result in "value". if return value == 0 , it was parsed, otherwise error code

Definition at line 801 of file command-parser.c.

References command::com, and namedarg().

◆ node_to_str()

void node_to_str ( long  l,
char *  buf 
)

Definition at line 67 of file addressing.c.

◆ on_command_received()

int on_command_received ( struct command com)

this is called for each command we receive

this is called as soon as a command is received that is destined for us (meaning: it is not called on routed packets). When this is called the packet is not yet ACK'ed to the sender.

Return values
int0 continue "normal" processing of command
int1 ack the receipt of the command
int2 nack the receipt of the command

Definition at line 53 of file userhooks.c.

◆ on_new_node()

void on_new_node ( struct hostroute host)

called when and if a new node is detected. this may be used, to, for example to activate when a route to the cloud becomes available

Definition at line 61 of file userhooks.c.

◆ onewire_init()

int onewire_init ( byte  idx)

Definition at line 359 of file onewire.c.

◆ onewire_reading_size()

int onewire_reading_size ( byte  idx)

Definition at line 355 of file onewire.c.

◆ onewire_run()

int onewire_run ( byte  idx,
byte *  error 
)

Definition at line 331 of file onewire.c.

◆ packet_buf_init()

void packet_buf_init ( const int  num)

initialize (reset, clear) a given buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_CC1101)
Return values
none

Definition at line 37 of file packetbuffer.c.

Referenced by packet_init().

◆ packet_getbuf()

byte * packet_getbuf ( const int  num)

get pointer to the contents of the buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
byte*get pointer to the buffer of bytes (all bytes, not just payload)!)

Definition at line 143 of file packetbuffer.c.

◆ packet_getbytesinbuf()

int packet_getbytesinbuf ( const int  num)

count bytes in the buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
intreturn the number of bytes in the packet

Definition at line 158 of file packetbuffer.c.

◆ packet_init()

void packet_init ( )

initialize (reset, clear) all buffers

Parameters
none
Return values
none

Definition at line 52 of file packetbuffer.c.

References packet_buf_init().

◆ packet_isvalid()

int packet_isvalid ( const int  num)

initialize (reset, clear) a given buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
none

returns 1 if there's a valid packet

Definition at line 125 of file packetbuffer.c.

◆ packet_mark_valid()

void packet_mark_valid ( const int  num)

mark this buffer as containing a valid packet

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
none

Definition at line 108 of file packetbuffer.c.

◆ packet_put_byte()

int packet_put_byte ( const int  num,
const byte  b 
)

add a byte to a buffer

Parameters
numthe number of the buffer (e.g. PACKETBUFFER_ESP8266)
bthe byte to add
Return values
thenew length of buffer (or <0 on error)

add a byte to the buffer returns NEW length of buf or <0 on error (e.g. overflow)

Definition at line 78 of file packetbuffer.c.

◆ pin_pwm()

void pin_pwm ( MCULIB_HANDLE  handle,
int  pin,
uint32_t  state,
int  flags 
)

Definition at line 188 of file fets.c.

◆ power_main_loop()

void power_main_loop ( )

Definition at line 107 of file powersave.c.

◆ power_set_connectivity()

int power_set_connectivity ( struct power_state ps,
int  turnon 
)

Definition at line 44 of file powersave.c.

◆ power_set_speed()

void power_set_speed ( int  speed)

Definition at line 225 of file powersave.c.

◆ pretty_node_to_str()

void pretty_node_to_str ( long  l,
char *  buf 
)

Definition at line 71 of file addressing.c.

◆ print_boot_info()

void print_boot_info ( )

print startup information

Definition at line 37 of file boot_info.c.

◆ print_esp_core_info()

void print_esp_core_info ( )

Definition at line 974 of file esp8266.c.

◆ print_node_id()

void print_node_id ( long  l)

Definition at line 90 of file addressing.c.

◆ print_outbound_queue()

void print_outbound_queue ( )

Definition at line 91 of file queue.c.

◆ print_pkt_state_update()

void print_pkt_state_update ( int  subsystem,
int  code,
uint8_t  d1,
uint8_t  d2 
)

print an esp8266 update packet in human readable format

Definition at line 1193 of file esp8266.c.

References esp_cloud_state_update().

◆ print_program_status()

void print_program_status ( )

Definition at line 81 of file main.c.

◆ print_pwm_state()

void print_pwm_state ( )

Definition at line 226 of file fets.c.

◆ print_stream_info()

void print_stream_info ( )

print summary of current streams to console

Definition at line 642 of file streams.c.

◆ printHelp()

void printHelp ( )

Definition at line 133 of file main.c.

◆ process_command()

void process_command ( struct command com)

command is parsed, now execute it

we call the router to update it (since we received a packet we might have just learned of the existence of another cat) then we branch out into any user supplied functions

Definition at line 808 of file command-handler.c.

References command::argctr, command::com, command_print(), command::flags, get_arg(), command::index, is_packet_for_us(), process_queue_reply(), and routing_request_reply().

◆ process_command_queue()

void process_command_queue ( )

this gets called when we got some cpu cycles spare we then send out commands and timeout other commands and so on

Definition at line 682 of file queue.c.

◆ process_queue_reply()

int process_queue_reply ( struct command ack)

process a reply

  • upon receipt of a reply (flag ACK set), call this. this will call the callback and remove it from the queue and free the command. it will return >0 if it has successfully processed the packet 0 if it doesn't know anything about this packet <0 if it should have processed the packet but failed to do so (retry?)

there is an internal mechanism used by send_reply & friends: if the command in the queue already has the ACK flag set, then it will be sent out and freed but no further notification and/or processing will take place.

Definition at line 326 of file queue.c.

Referenced by process_command().

◆ process_strobe_command()

void process_strobe_command ( struct command com)

Definition at line 791 of file command-handler.c.

◆ process_terminal_input()

void process_terminal_input ( )

Definition at line 252 of file main.c.

◆ query_onewire()

int query_onewire ( struct onewire_hwdef hw,
byte *  error 
)

Definition at line 307 of file onewire.c.

◆ queue_init()

void queue_init ( )

Definition at line 80 of file queue.c.

◆ received_radio_get_config()

int received_radio_get_config ( struct command com)

called when we received radio_get_config command sends back an answer with the current radio config

Definition at line 860 of file ti1101.c.

References alloc_command(), command::com, command_add_binary_arg(), command_init(), command::connid, command::flags, and command::target.

◆ received_radio_set_config()

int received_radio_set_config ( struct command com)

called when we received radio_set_config command modified the current radio config

Definition at line 905 of file ti1101.c.

References command::com, get_arg(), and get_arg_size().

◆ remove_stale_routes()

void remove_stale_routes ( )

"old" routes are being removed this is the route garbage collector

Definition at line 264 of file routing.c.

◆ request_route()

void request_route ( long  host)

send an arp request (equivalent)

Definition at line 776 of file queue.c.

References alloc_command(), command::com, command_add_arg(), free_command(), and send_command().

◆ routing_count_nodes()

int routing_count_nodes ( )

determine number of nodes known

Return values
intnumber of nodes known to us excluding ourselves

Definition at line 203 of file routing.c.

Referenced by list_modules().

◆ routing_error()

void routing_error ( struct command com,
int  errorcode 
)

Definition at line 591 of file routing.c.

◆ routing_event_loop()

void routing_event_loop ( )

Definition at line 440 of file routing.c.

◆ routing_find_empty_slot()

struct hostroute * routing_find_empty_slot ( )

finds an empty slot in our routing entry list

Definition at line 239 of file routing.c.

Referenced by routing_request_reply().

◆ routing_find_host()

struct hostroute * routing_find_host ( const long  nodeid)

find route to host or NULL if none known

Definition at line 315 of file routing.c.

◆ routing_find_route()

struct hostroute * routing_find_route ( const long  nodeid,
const byte  sourcedev 
)

find specific hostroute to target or NULL if none known special case, if we ask for a route to server, we get any intermediary routes which announce themselves to have a connection a server

Definition at line 286 of file routing.c.

Referenced by routing_request_reply().

◆ routing_get_node_by_index()

struct hostroute * routing_get_node_by_index ( const int  index)

finds a nodeid by index. [0...n]

Return values
hoststructureof this node. NULL if none at this index

Definition at line 219 of file routing.c.

Referenced by list_modules().

◆ routing_init()

void routing_init ( )

called when we power-up

power-up initialisation

Definition at line 57 of file routing.c.

◆ routing_print_table()

void routing_print_table ( )

print routing table

Definition at line 539 of file routing.c.

References get_hops_to_server(), and hostroute::host.

◆ routing_request_reply()

void routing_request_reply ( const struct command com)

we call this when we receive a reply to a routing request this adds or updates a new route

Definition at line 359 of file routing.c.

References command::argctr, get_arg(), hostroute::host, routing_find_empty_slot(), routing_find_route(), command::sender, and command::sourcedev.

Referenced by process_command().

◆ sc_fancy_allocator_init()

void sc_fancy_allocator_init ( )

Definition at line 78 of file multiram.c.

◆ sc_free()

void sc_free ( void *  ptr)

Definition at line 85 of file multiram.c.

◆ sc_realloc()

void * sc_realloc ( void *  ptr,
size_t  size 
)

Definition at line 81 of file multiram.c.

◆ send_command()

int send_command ( struct command com)

send a command to another module (or broadcast)

  • this sends out a command. the sender must be filled in correctly and, if required, the forwarding host. if the sourcedev is 0, it will find the best route (via radio or wifi), otherwise, if the sourcedev specifies a technology, it will use that technology this is a one-shot attempt. no redelivery will be attempted and no feedback is available whether or not it arrived at the destination. the packet buffer remains under the responsibility of the caller. especially CALLER MUST FREE COMMAND AFTER THIS FUNCTION RETURNS unless you really know what you're doing please use deliver_command instead

this is synchronous and a one-shot attempt return: 0 ok, >0 on permanent errors, <0 on temporary errors

Definition at line 374 of file queue.c.

Referenced by list_modules(), request_route(), and send_data().

◆ send_command_fw_info()

int send_command_fw_info ( struct command com,
int  err 
)

send a reply to a command

  • send the reply (replycom) to the sender. It will send the reply back via the same device it has received the command on. the reply will be a new command, with NO parameters! return the result of deliver command

Definition at line 533 of file queue.c.

References alloc_command(), command::com, command_init(), command::connid, deliver_command(), command::encoding, command::flags, command::index, command::sourcedev, and command::target.

◆ send_command_one_arg()

int send_command_one_arg ( int  command,
long  target,
const byte *  arg1,
int  arg1len 
)

helper function to quickly and easily send a command somewhere return 0 if ok, else errorcode

Definition at line 567 of file routing.c.

References alloc_command(), command::com, command_add_binary_arg(), deliver_command(), and command::target.

◆ send_command_quietly()

int send_command_quietly ( struct command com)

Definition at line 384 of file queue.c.

◆ send_command_reply()

int send_command_reply ( struct command com,
byte  flags 
)

send a reply to a command

  • send the reply (replycom) to the sender. It will send the reply back via the same device it has received the command on. the reply will be a new command, with NO parameters! return the result of deliver command

Definition at line 562 of file queue.c.

References alloc_command(), command::com, command_init(), command::connid, deliver_command(), command::encoding, command::flags, command::index, command::sourcedev, and command::target.

Referenced by getpubkey(), list_modules(), set_config_flag(), and setcloudtoken().

◆ send_command_reply_with_args()

int send_command_reply_with_args ( struct command com,
byte  flags,
const char *  format,
  ... 
)

send a reply to a command

  • send the reply (replycom) to the sender. It will send the reply back via the same device it has received the command on. the reply will be a new command, with NO parameters! return the result of deliver command

Definition at line 588 of file queue.c.

References alloc_command(), command::com, command_add_varg(), command_init(), command::connid, deliver_command(), command::encoding, command::flags, command::index, command::sourcedev, and command::target.

◆ send_data()

int send_data ( struct command com,
const char *  format,
  ... 
)

send the format string as data in response to command "com"

return 0 if ok, otherwise error code

Definition at line 294 of file queue.c.

References command::com, command_add_varg(), free_command(), get_data_reply(), and send_command().

◆ send_routing_update_now()

void send_routing_update_now ( )

Definition at line 459 of file routing.c.

◆ send_user_app_status()

int send_user_app_status ( )

Definition at line 355 of file user_app_exe.c.

◆ sensor_activation()

void sensor_activation ( struct sensorruntime sr,
int  activation 
)

Definition at line 771 of file sensor.c.

◆ sensor_com_config()

void sensor_com_config ( struct command com)

Definition at line 70 of file sensor_command.c.

◆ sensor_com_list()

void sensor_com_list ( struct command com)

Definition at line 24 of file sensor_command.c.

◆ sensor_deregister()

void sensor_deregister ( struct sensordev sensor)

Definition at line 1008 of file sensor.c.

◆ sensor_info()

void sensor_info ( )

Definition at line 499 of file sensor.c.

◆ sensor_loop()

int sensor_loop ( )

called periodically. this will either query sensors when they are due or will set the isdue flag for them to be picked up during IRQ returns true if new sensor data needs to be sent

Definition at line 845 of file sensor.c.

◆ sensor_probe()

void sensor_probe ( )

Definition at line 782 of file sensor.c.

◆ sensor_register()

struct sensordev * sensor_register ( struct sensordev sensor)

register a sensor, e.g. from userhook. The sensordev struct is COPIED, so it may be reused by the caller. the RETURN value is a pointer to the new sensordev, or NULL

register a new sensor. returns 0 if ok

Definition at line 644 of file sensor.c.

References sensors, sensors_init(), and sensors_off().

◆ sensor_run_str()

void sensor_run_str ( const char *  str)

Definition at line 706 of file sensor.c.

◆ sensor_submit_request()

int sensor_submit_request ( const long  nodeid,
int  idx,
const int  readmillis,
const int  submitsec,
const int  max_values 
)

Definition at line 600 of file sensor.c.

◆ sensor_update_config()

int sensor_update_config ( const long  nodeid,
int  idx,
const int  readmillis,
const int  submitsec,
const int  max_values 
)

Definition at line 550 of file sensor.c.

◆ sensors_init()

void sensors_init ( )

initialize sensors, runtime, config, powerup each sensor in turn etc..

Definition at line 382 of file sensor.c.

Referenced by sensor_register().

◆ sensors_inited()

uint8_t sensors_inited ( )

Definition at line 835 of file sensor.c.

◆ sensors_newstyle()

void sensors_newstyle ( )

enable new-style sensors (and disable old)

Definition at line 621 of file sensor.c.

◆ sensors_off()

void sensors_off ( )

disable sensors

Definition at line 629 of file sensor.c.

Referenced by sensor_register().

◆ serialirq()

void serialirq ( int  port,
byte  b 
)

Definition at line 500 of file main.c.

◆ set_config_flag()

void set_config_flag ( struct command com)

set a single config flag

Definition at line 310 of file command-handler.c.

References command::argctr, get_arg(), and send_command_reply().

◆ set_esp8266_debug()

void set_esp8266_debug ( byte  b)

Definition at line 311 of file esp8266.c.

◆ set_esp8266_usart_mode()

void set_esp8266_usart_mode ( int  i)

Definition at line 967 of file esp8266.c.

◆ set_forward_debug()

void set_forward_debug ( byte  b)

Definition at line 23 of file forwarding.c.

◆ set_in_app()

void set_in_app ( uint8_t  a)

Definition at line 145 of file user_app_exe.c.

◆ set_logging()

void set_logging ( struct command com)

Definition at line 159 of file command-handler.c.

◆ set_mcu_power_mode()

int set_mcu_power_mode ( int  state)

Definition at line 73 of file powersave.c.

◆ set_new_node_id()

void set_new_node_id ( char *  nodetxt)

Definition at line 69 of file main.c.

◆ set_routing_debug()

void set_routing_debug ( byte  b)

Definition at line 98 of file routing.c.

◆ setcloudtoken()

void setcloudtoken ( struct command com)

set a token to connect to the cloud

  • once a token is set the module will maintain a connection to the cloud servers.

Definition at line 254 of file command-handler.c.

References command::argctr, esp8266_send_instructions(), get_arg(), and send_command_reply().

◆ setdac()

void setdac ( struct command com)

Definition at line 425 of file command-handler.c.

◆ setpin()

void setpin ( struct command com)

Definition at line 81 of file command-handler.c.

◆ start()

int start ( int  mculib_handle,
struct sc_firmware_api uapi 
)

this is called when the board powers up

all the initialisation of peripherals has been completed. a return code other than 0 is considered an error, userapp failed and no further code is called.

Definition at line 31 of file userhooks.c.

◆ start_strobe()

void start_strobe ( int  relay,
int  ton,
int  toff,
int  repeat 
)

Definition at line 719 of file command-handler.c.

◆ start_wifi_scan()

void start_wifi_scan ( )

Definition at line 1374 of file esp8266.c.

◆ stop()

void stop ( )

Definition at line 39 of file userhooks.c.

◆ stream_associate()

int stream_associate ( int  fd,
const struct consumerinfo ci,
byte *  buf,
int  bufsize,
int  packetsize 
)

associate a stream with a consumer. return 0 if ok otherwise errorcode

Definition at line 124 of file streams.c.

◆ stream_disable()

void stream_disable ( )

disable all stream handling

Definition at line 47 of file streams.c.

◆ stream_enable()

void stream_enable ( )

enable all stream handling (default)

Definition at line 54 of file streams.c.

◆ stream_init()

void stream_init ( )

Definition at line 35 of file streams.c.

◆ stream_loop()

void stream_loop ( )

called periodically, checks for stale streams and/or hung ones

Definition at line 590 of file streams.c.

◆ stream_seterror()

void stream_seterror ( int  streamfd,
const char *  format,
  ... 
)

Definition at line 672 of file streams.c.

◆ streamdata()

void streamdata ( struct command com)

called when we receive a stream data packet TODO: this is a really simplistic, memory-consumption optimized algorithm. it currently discards packets which are out-of-order and keeps requesting the next packet in order. Possible optimisations:

  1. use ram buffers to buffer correctly received packets
  2. increase payload of packets (limited to 250 bytes currently)

Definition at line 451 of file streams.c.

◆ streamsetup()

void streamsetup ( struct command com)

called when we receive a stream setup packet

Definition at line 305 of file streams.c.

◆ ti1101_compare_config()

int ti1101_compare_config ( )

check the config against the values in flash

  • Returns
    0 if ok, 1 if not. (it is not an error if values are different, but it is if they are all 0) it is an error if more values are different than correct

Definition at line 335 of file ti1101.c.

◆ ti1101_cssns()

int ti1101_cssns ( )

Definition at line 9 of file ti1101-pinconfig.c.

◆ ti1101_disable()

void ti1101_disable ( )

Definition at line 639 of file ti1101.c.

◆ ti1101_disable_irq()

void ti1101_disable_irq ( struct network_context ctx)

Definition at line 812 of file ti1101.c.

◆ ti1101_enable_irq()

void ti1101_enable_irq ( )

Definition at line 820 of file ti1101.c.

◆ ti1101_event_loop_locked()

void ti1101_event_loop_locked ( )

Definition at line 750 of file ti1101.c.

◆ ti1101_failure()

void ti1101_failure ( )

Definition at line 75 of file ti1101.c.

◆ ti1101_forward_radio()

void ti1101_forward_radio ( long  node)

forward all radio packets to this node mostly useful to debug and decode and sniff 3rd party protocols like door openers, thermostats etc...

Definition at line 928 of file ti1101.c.

◆ ti1101_get_last_irq_error()

byte ti1101_get_last_irq_error ( )

if we throw an error in the irq we cannot print it directly. save it and return it here. the irq_error is cleared by reading from it.

Definition at line 695 of file ti1101.c.

◆ ti1101_irqpin()

int ti1101_irqpin ( )

Definition at line 15 of file ti1101-pinconfig.c.

◆ ti1101_is_enabled()

int ti1101_is_enabled ( )

Definition at line 656 of file ti1101.c.

◆ ti1101_lock()

int ti1101_lock ( )

lock, return 1 if ok, otherwise it is an error

Definition at line 119 of file ti1101.c.

◆ ti1101_loop()

int ti1101_loop ( struct network_context ctx)

this is called in the main thread periodically

Definition at line 801 of file ti1101.c.

◆ ti1101_off()

int ti1101_off ( )

diable processing of ti1101 commands

the radio remains fully operational but any IRQs for in/outbound data are effectively a noop this can (and is) used to temporarily and quickly disable the radio without the need to reinitialise the peripheral when re-enabling it return: 1 if it was enabled previously, 0 if it was not

Definition at line 629 of file ti1101.c.

◆ ti1101_on()

void ti1101_on ( )

enable processing of radio

this does not reconfigure the ti1101, but it does start processing again

Definition at line 650 of file ti1101.c.

◆ ti1101_print_config()

void ti1101_print_config ( )

Definition at line 319 of file ti1101.c.

◆ ti1101_print_status()

void ti1101_print_status ( )

Definition at line 496 of file ti1101.c.

◆ ti1101_read_byte()

byte ti1101_read_byte ( )

Definition at line 659 of file ti1101.c.

◆ ti1101_read_version()

int ti1101_read_version ( )

Definition at line 665 of file ti1101.c.

◆ ti1101_receive_loop()

void ti1101_receive_loop ( )

Definition at line 530 of file ti1101.c.

◆ ti1101_rx()

void ti1101_rx ( )

Definition at line 217 of file ti1101.c.

◆ ti1101_set_debug()

void ti1101_set_debug ( byte  b)

set debug mode of ti1101

Definition at line 78 of file ti1101.c.

◆ ti1101_spiport()

int ti1101_spiport ( )

Definition at line 12 of file ti1101-pinconfig.c.

◆ ti1101_transmit()

int ti1101_transmit ( struct network_context nctx,
const byte *  data,
uint16_t  num_bytes 
)

Definition at line 933 of file ti1101.c.

◆ ti1101_tx()

int ti1101_tx ( )

Definition at line 213 of file ti1101.c.

◆ ti1101_unlock()

void ti1101_unlock ( )

Definition at line 134 of file ti1101.c.

◆ update_all_runtimes()

int update_all_runtimes ( )

update runtimes (recalculate buffer positions). return 0 if ok (5 otherwise)

Definition at line 281 of file sensor.c.

◆ user_app_checksum_valid()

int user_app_checksum_valid ( )

Definition at line 237 of file user_app_exe.c.

◆ user_app_control()

void user_app_control ( struct command com)

Definition at line 417 of file user_app_exe.c.

◆ user_app_disable()

void user_app_disable ( )

Definition at line 224 of file user_app_exe.c.

◆ user_app_enable()

void user_app_enable ( )

Definition at line 208 of file user_app_exe.c.

◆ user_app_exe_init()

void user_app_exe_init ( )

Definition at line 150 of file user_app_exe.c.

◆ user_app_executable()

int user_app_executable ( )

Definition at line 282 of file user_app_exe.c.

◆ user_app_info()

int user_app_info ( struct command com)

Definition at line 382 of file user_app_exe.c.

◆ user_app_is_enabled()

int user_app_is_enabled ( )

Definition at line 198 of file user_app_exe.c.

◆ user_app_is_valid()

int user_app_is_valid ( )

Definition at line 265 of file user_app_exe.c.

◆ user_app_reset_state()

void user_app_reset_state ( )

Definition at line 344 of file user_app_exe.c.

◆ user_loop()

void user_loop ( )

this is called frequently, but with no timing guarantees. essentially, it's called in the "idle-loop" of the mcu

Definition at line 67 of file userhooks.c.

◆ user_serial_callback()

int user_serial_callback ( int  portnum,
int  byte 
)

Definition at line 551 of file user_app_exe.c.

◆ userapp_checksum_valid()

int userapp_checksum_valid ( void *  baseadr)

Definition at line 494 of file user_app_exe.c.

◆ wifi_info()

void wifi_info ( struct command com)

get some information about our currentwifi connection

Definition at line 350 of file command-handler.c.

References alloc_command(), command_add_arg(), and esp8266_get_current_ip().

◆ wifi_new_creds()

void wifi_new_creds ( char *  buf)

Definition at line 1019 of file esp8266.c.

◆ wifi_send_data()

void wifi_send_data ( const PACKET_TYPE  type,
const byte *  buf,
const int  len 
)

send a command via wifi

Definition at line 617 of file esp8266.c.

◆ wifi_update_completed()

void wifi_update_completed ( )

Definition at line 1054 of file esp8266.c.

◆ wifi_update_progress()

void wifi_update_progress ( const uint8_t *  buf)

Definition at line 1058 of file esp8266.c.

◆ wifi_update_started()

void wifi_update_started ( )

Definition at line 1050 of file esp8266.c.

◆ wireless_callback_state_change()

void wireless_callback_state_change ( int  newstate,
int  oldstate 
)

Definition at line 1707 of file esp8266.c.

◆ write_char_to_console()

int write_char_to_console ( char  b)

Definition at line 1764 of file esp8266.c.

◆ write_serial_char()

int write_serial_char ( int  port,
char  b 
)

Definition at line 19 of file compat.c.

◆ write_serial_line()

int write_serial_line ( int  port,
const char *  txt 
)

Definition at line 14 of file compat.c.

◆ write_serial_string()

int write_serial_string ( int  port,
const char *  txt 
)

Definition at line 8 of file compat.c.

Variable Documentation

◆ ack_ctr

int ack_ctr
extern

the ack_ctr for pings

◆ acm_byte_received

uint32_t acm_byte_received
extern

Definition at line 19 of file usb.c.

◆ attemptctr

int attemptctr

command to send

Definition at line 57 of file queue.c.

◆ BAUD_CHANGE_INDICATOR

const char* BAUD_CHANGE_INDICATOR = "NEW BAUDRATE: ["

Definition at line 115 of file esp8266.c.

◆ brightness

uint8_t brightness

Definition at line 48 of file led.c.

◆ buf [1/2]

byte buf[260]

Definition at line 33 of file decode_esp_packet.c.

◆ buf [2/2]

byte buf[300]

Definition at line 18 of file streams.c.

◆ bufs

struct espbuf bufs[7]

Definition at line 35 of file decode_esp_packet.c.

◆ callback

pkt_callback callback

how many times did we try already?

Definition at line 58 of file queue.c.

◆ colour

uint32_t colour

Definition at line 47 of file led.c.

◆ command

struct command* command

Definition at line 56 of file queue.c.

◆ command_names

const char* const command_names[]

Definition at line 41 of file command-parser.c.

◆ console_ringbuffer

struct ringbuffer console_ringbuffer

Definition at line 58 of file main.c.

◆ device

uint8_t device

Definition at line 31 of file routing.h.

◆ esp_ringbuffer

struct ringbuffer esp_ringbuffer

Definition at line 49 of file esp8266.c.

◆ esptmpbuf

char esptmpbuf[128]

Definition at line 113 of file esp8266.c.

◆ extled

struct leddef extled = { .pins = { 7, 110, 111 }, .timers = { 2, 1, 1 } }

Definition at line 39 of file led.c.

◆ fd

int fd

Definition at line 16 of file streams.c.

◆ flashconsumerinfo

const struct consumerinfo flashconsumerinfo = { &flash_app_consumer, &flash_app_close }

Definition at line 23 of file flashapp.c.

◆ hal

struct hal_workspace hal

Definition at line 45 of file main.c.

◆ hops_to_server

uint8_t hops_to_server

Definition at line 32 of file routing.h.

◆ host

long host

the hosts nodeid this route refers to

Definition at line 21 of file routing.h.

Referenced by forward_packet(), list_modules(), routing_print_table(), and routing_request_reply().

◆ hosttype

uint8_t hosttype

see https://www.singingcat.net?linkid=routing

Definition at line 36 of file routing.h.

◆ intled

struct leddef intled = { .pins = { 106, 107, 108 }, .timers = { 3, 3, 3 } }

Definition at line 38 of file led.c.

◆ last_attempt

long last_attempt

the optional callback on delivery result

Definition at line 59 of file queue.c.

◆ lastip

struct ipv4address lastip

Definition at line 97 of file esp8266.c.

◆ lastseen

long lastseen

seconds since boot since we last saw this (for expiry of entries)

Definition at line 22 of file routing.h.

◆ lora_on

byte lora_on

Definition at line 39 of file powersave.c.

◆ machinecolour

struct ledcolour machinecolour

Definition at line 54 of file led.c.

◆ max_values

int max_values

Definition at line 51 of file sensor.c.

◆ MCULIBHANDLE

int MCULIBHANDLE

Definition at line 21 of file userhooks.c.

◆ nexthop

long nexthop

here the nodeif of the intermediary hop (the proxy)

Definition at line 27 of file routing.h.

◆ off

uint32_t off

Definition at line 50 of file led.c.

◆ on

uint32_t on

Definition at line 49 of file led.c.

◆ order

int order

Definition at line 31 of file decode_esp_packet.c.

◆ packetbuffer1

struct cnw_packetbuf packetbuffer1

Definition at line 15 of file packetbuffer.c.

◆ pin

uint8_t pin

Definition at line 9 of file fets.c.

◆ pins

int pins[3]

Definition at line 30 of file led.c.

◆ prev_state

struct power_state prev_state

Definition at line 42 of file powersave.c.

◆ pwm

uint8_t pwm

Definition at line 10 of file fets.c.

◆ r_adr

volatile uint32_t* r_adr = (volatile uint32_t *)0x40020810

Definition at line 69 of file onewire.c.

◆ rbuf

char rbuf[10]

Definition at line 258 of file command-parser.c.

◆ readmillis

int readmillis

Definition at line 49 of file sensor.c.

◆ sbuf

char sbuf[10]

Definition at line 257 of file command-parser.c.

◆ sensor

const struct sensordev* sensor

Definition at line 47 of file sensor.c.

◆ sensors

struct sensordev sensors[]
Initial value:
= {
{ 0, &onewire_init, NULL, &onewire_reading_size, &onewire_run, NULL, "ow1:ds18b20", "temp", "celsius", "centi", 207 },
{ 0, &onewire_init, NULL, &onewire_reading_size, &onewire_run, NULL, "ow2:ds18b20", "temp", "celsius", "centi", 211 },
{ 0, &onewire_init, NULL, &onewire_reading_size, &onewire_run, NULL, "ow3:ds18b20", "temp", "celsius", "centi", 212 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
}

list of sensors...

Definition at line 23 of file sensor.c.

Referenced by sensor_register().

◆ signal_indicator

uint8_t signal_indicator

Definition at line 37 of file routing.h.

◆ size [1/2]

int size

Definition at line 32 of file decode_esp_packet.c.

◆ size [2/2]

int size

Definition at line 17 of file streams.c.

◆ speed

uint32_t speed

Definition at line 12 of file fets.c.

◆ statetable

const char* statetable[]
Initial value:
= {
"SLEEP",
"IDLE",
"XOFF",
"VCOON_MC",
"REGON_MC",
"MANCAL",
"VCOON",
"REGON",
"STARTCAL",
"BWBOOST",
"FS_LOCK",
"IFADCON",
"ENDCAL",
"RX",
"RX_END",
"RX_RST",
"TXRX_SWITCH",
"RXFIFO_OVERFLOW",
"FSTXON",
"TX",
"TX_END",
"RXTX_SWITCH",
"TXFIFO_UNDERFLOW",
NULL
}

Definition at line 42 of file ti1101.c.

◆ streams

struct stream streams[2]

mgmt for streams (the more ram, the more simultanous streams we can handle

Definition at line 27 of file streams.c.

◆ submitsecs

int submitsecs

Definition at line 50 of file sensor.c.

◆ target

long target

Definition at line 48 of file sensor.c.

◆ target_pwm

uint32_t target_pwm

Definition at line 11 of file fets.c.

◆ tbuf

char tbuf[10]

Definition at line 259 of file command-parser.c.

◆ ti1101_in_read_loop

volatile byte ti1101_in_read_loop = 0

Definition at line 28 of file ti1101.c.

◆ ti1101_locked

volatile byte ti1101_locked = 0

Definition at line 29 of file ti1101.c.

◆ ti1101_on

byte ti1101_on

Definition at line 38 of file powersave.c.

◆ timers

int timers[3]

Definition at line 31 of file led.c.

◆ tn

int tn

Definition at line 15 of file streams.c.

◆ UMM_MALLOC_CFG_HEAP_ADDR

void* UMM_MALLOC_CFG_HEAP_ADDR

Definition at line 75 of file multiram.c.

◆ UMM_MALLOC_CFG_HEAP_SIZE

uint32_t UMM_MALLOC_CFG_HEAP_SIZE

Definition at line 76 of file multiram.c.

◆ userapp_vector

struct userapp_info userapp_vector
extern

Definition at line 12 of file userapp_vector.c.

◆ usercolour

struct ledcolour usercolour

Definition at line 53 of file led.c.

◆ value

uint32_t value

Definition at line 13 of file fets.c.

◆ wifi_on

byte wifi_on

Definition at line 37 of file powersave.c.

◆ wifi_state_since [1/2]

long wifi_state_since = 0

Definition at line 24 of file esp8266.c.

◆ wifi_state_since [2/2]

long wifi_state_since
extern

Definition at line 24 of file esp8266.c.

◆ wr_adr

volatile uint32_t* wr_adr = (volatile uint32_t *)0x40020814

Definition at line 83 of file onewire.c.