diff --git a/examples/osd/arduino-settingsmanager/Makefile b/examples/osd/arduino-settingsmanager/Makefile index d9b4b7bd9..11f81bff8 100644 --- a/examples/osd/arduino-settingsmanager/Makefile +++ b/examples/osd/arduino-settingsmanager/Makefile @@ -12,7 +12,7 @@ CONTIKI_WITH_IPV6 = 1 CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" CFLAGS += -DCONTIKI_CONF_SETTINGS_MANAGER=1 -PROJECT_SOURCEFILES += ${SKETCH}.cpp extended-rf-api.c +PROJECT_SOURCEFILES += ${SKETCH}.cpp shell-merkur.c extended-rf-api.c # automatically build RESTful resources REST_RESOURCES_DIR = ./resources diff --git a/examples/osd/arduino-settingsmanager/extended-rf-api.h b/examples/osd/arduino-settingsmanager/extended-rf-api.h index 8e4ca0d34..aed9a7e84 100644 --- a/examples/osd/arduino-settingsmanager/extended-rf-api.h +++ b/examples/osd/arduino-settingsmanager/extended-rf-api.h @@ -35,14 +35,6 @@ #ifndef EXTENDED_RF_API_H_ #define EXTENDED_RF_API_H_ -#include "contiki.h" -#include "net/netstack.h" -#include "dev/radio.h" - -#include -#include -#include - void print_64bit_addr(const uint8_t *addr); radio_result_t get_object(radio_param_t param, void *dest, size_t size); radio_result_t set_object(radio_param_t param, void *src, size_t size); diff --git a/examples/osd/arduino-settingsmanager/shell-merkur.c b/examples/osd/arduino-settingsmanager/shell-merkur.c index 531b4e847..acfe63ccd 100644 --- a/examples/osd/arduino-settingsmanager/shell-merkur.c +++ b/examples/osd/arduino-settingsmanager/shell-merkur.c @@ -48,7 +48,8 @@ #include "net/rime/timesynch.h" #include "dev/radio.h" #include "sys/node-id.h" - +#include "lib/settings.h" +#include "extended-rf-api.h" #include #include @@ -56,69 +57,66 @@ PROCESS(shell_txpower_process, "txpower"); SHELL_COMMAND(txpower_command, "txpower", - "txpower : change CC2420 transmission power (0 - 31)", + "txpower : change transmission power 0 (3dbm, default) to 15 (-17.2dbm)", &shell_txpower_process); PROCESS(shell_rfchannel_process, "rfchannel"); SHELL_COMMAND(rfchannel_command, "rfchannel", - "rfchannel : change CC2420 radio channel (11 - 26)", + "rfchannel : change radio channel (11 - 26)", &shell_rfchannel_process); /*---------------------------------------------------------------------------*/ PROCESS_THREAD(shell_txpower_process, ev, data) { - struct { - uint16_t len; - uint16_t txpower; - } msg; + radio_value_t value; + char buf[20]; const char *newptr; PROCESS_BEGIN(); - msg.txpower = shell_strtolong(data, &newptr); + value = shell_strtolong(data, &newptr); /* If no transmission power was given on the command line, we print out the current txpower. */ - - if(newptr == data) { - msg.txpower = rf230_get_txpower(); + if(newptr == data) { + if(get_param(RADIO_PARAM_TXPOWER, &value) == RADIO_RESULT_OK) { + + } } else { - rf230_set_txpower(msg.txpower); + set_param(RADIO_PARAM_TXPOWER, value); } - msg.len = 1; - - shell_output(&txpower_command, &msg, sizeof(msg), "", 0); + snprintf(buf, sizeof(buf), "%3d", value); + shell_output_str(&txpower_command, "dBm: ", buf); PROCESS_END(); } /*---------------------------------------------------------------------------*/ PROCESS_THREAD(shell_rfchannel_process, ev, data) { - struct { - uint16_t len; - uint16_t channel; - } msg; + radio_value_t value; + char buf[20]; const char *newptr; PROCESS_BEGIN(); - msg.channel = shell_strtolong(data, &newptr); + value = shell_strtolong(data, &newptr); /* If no channel was given on the command line, we print out the current channel. */ if(newptr == data) { - msg.channel = rf230_get_channel(); + if(get_param(RADIO_PARAM_CHANNEL, &value) == RADIO_RESULT_OK) { + + } } else { - rf230__set_channel(msg.channel); + set_param(RADIO_PARAM_CHANNEL, value); } - msg.len = 1; - - shell_output(&rfchannel_command, &msg, sizeof(msg), "", 0); + snprintf(buf, sizeof(buf), "%d", value); + shell_output_str(&rfchannel_command, "Channel: ", buf); PROCESS_END(); } /*---------------------------------------------------------------------------*/ void -shell_sky_init(void) +shell_merkur_init(void) { shell_register_command(&txpower_command); shell_register_command(&rfchannel_command); diff --git a/examples/osd/arduino-settingsmanager/sketch.pde b/examples/osd/arduino-settingsmanager/sketch.pde index 55af253c2..99b63088d 100644 --- a/examples/osd/arduino-settingsmanager/sketch.pde +++ b/examples/osd/arduino-settingsmanager/sketch.pde @@ -215,13 +215,14 @@ void setup (void) shell_reboot_init(); // shell_text_init(); // shell_time_init(); -// shell_merkur_init(); + shell_merkur_init(); #if COFFEE shell_coffee_init(); shell_file_init(); #endif - + + get_rf_consts(); print_rf_values(); // init coap resourcen rest_init_engine ();