Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFM69 radio link integration #87

Open
wants to merge 24 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ ifdef SERVALD_WRAP
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= servalwrap.c
LOCAL_MODULE:= servald
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
include $(BUILD_EXECUTABLE)
endif

Expand All @@ -60,5 +62,7 @@ ifdef SERVALD_SIMPLE
LOCAL_LDLIBS := $(SERVALD_LOCAL_LDLIBS)
LOCAL_STATIC_LIBRARIES := $(SERVALD_LOCAL_STATIC_LIBRARIES)
LOCAL_MODULE:= servaldsimple
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
include $(BUILD_EXECUTABLE)
endif
2 changes: 1 addition & 1 deletion conf_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ ATOM(bool_t, mdprequests, 0, boolean,, "")
ATOM(bool_t, mdp_filter, 0, boolean,, "")
ATOM(bool_t, msp, 0, boolean,, "")
ATOM(bool_t, monitor, 0, boolean,, "")
ATOM(bool_t, radio_link, 0, boolean,, "")
ATOM(int, radio_link, 0, int,, "")
ATOM(bool_t, overlaybuffer, 0, boolean,, "")
ATOM(bool_t, overlayframes, 0, boolean,, "")
ATOM(bool_t, packets_sent, 0, boolean,, "")
Expand Down
2 changes: 2 additions & 0 deletions headerfiles.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ HDRS= fifo.h \
mdp_client.h \
msp_client.h \
radio_link.h \
radio_link_rfd900.h \
radio_link_rfm69.h \
sqlite-amalgamation-3070900/sqlite3.h
5 changes: 4 additions & 1 deletion mdp_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ struct overlay_mdp_data_frame {
uint16_t payload_length;
int queue;
int ttl;
unsigned char payload[MDP_MTU-100];
union{
unsigned char payload[MDP_MTU-100];
struct overlay_route_record route_record;
};
};

struct overlay_mdp_error {
Expand Down
2 changes: 1 addition & 1 deletion network_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static int app_route_print(const struct cli_parsed *parsed, struct cli_context *

int ofs=0;
while(ofs + sizeof(struct overlay_route_record) <= rx.out.payload_length){
struct overlay_route_record *p=(struct overlay_route_record *)&rx.out.payload[ofs];
struct overlay_route_record *p=&rx.out.route_record;
ofs+=sizeof(struct overlay_route_record);

if (p->reachable==REACHABLE_NONE)
Expand Down
7 changes: 4 additions & 3 deletions overlay_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ overlay_interface_init(const char *name, struct socket_address *addr,
interface->socket_type = ifconfig->socket_type;
interface->uartbps = ifconfig->uartbps;
interface->ctsrts = ifconfig->ctsrts;
interface->radiotype = ifconfig->radiotype;
set_destination_ref(&interface->destination, NULL);
interface->destination = new_destination(interface, ifconfig->encapsulation);

Expand Down Expand Up @@ -753,7 +754,7 @@ static void overlay_interface_poll(struct sched_ent *alarm)

switch(interface->socket_type){
case SOCK_STREAM:
radio_link_tx(interface);
radio_link_callback(interface);
return;
case SOCK_DGRAM:
break;
Expand All @@ -774,7 +775,7 @@ static void overlay_interface_poll(struct sched_ent *alarm)
if (alarm->poll.revents & POLLOUT){
switch(interface->socket_type){
case SOCK_STREAM:
radio_link_tx(interface);
radio_link_callback(interface);
return;
case SOCK_DGRAM:
case SOCK_FILE:
Expand All @@ -792,7 +793,7 @@ static void overlay_interface_poll(struct sched_ent *alarm)
interface_read_stream(interface);
// if we read a valid heartbeat packet, we may be able to write more bytes now.
if (interface->state==INTERFACE_STATE_UP){
radio_link_tx(interface);
radio_link_callback(interface);
return;
}
break;
Expand Down
1 change: 1 addition & 0 deletions overlay_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ typedef struct overlay_interface {

unsigned int uartbps; // set serial port speed (which might be different from link speed)
int ctsrts; // enabled hardware flow control if non-zero
int radiotype; // the type of radio link

struct network_destination *destination;

Expand Down
2 changes: 1 addition & 1 deletion overlay_mdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ static int routing_table(struct subscriber *subscriber, void *context)
overlay_mdp_frame reply;
bzero(&reply, sizeof(overlay_mdp_frame));

struct overlay_route_record *r=(struct overlay_route_record *)&reply.out.payload;
struct overlay_route_record *r=&reply.out.route_record;
reply.packetTypeAndFlags=MDP_TX;
reply.out.payload_length=sizeof(struct overlay_route_record);
r->sid = subscriber->sid;
Expand Down
2 changes: 1 addition & 1 deletion overlay_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int overlay_queue_init(){
int i;
for(i=0;i<OQ_MAX;i++) {
overlay_tx[i].maxLength=100;
overlay_tx[i].latencyTarget=1000; /* Keep packets in queue for 1 second by default */
overlay_tx[i].latencyTarget=2000; /* Keep packets in queue for 1 second by default */
overlay_tx[i].small_packet_grace_interval = 5;
}
/* expire voice/video call packets much sooner, as they just aren't any use if late */
Expand Down
Loading