cleanup code

This commit is contained in:
Harald Pichler 2017-09-08 08:26:36 +02:00
parent 3a560c79f9
commit df282f348c
5 changed files with 39 additions and 31 deletions

View file

@ -1,8 +1,37 @@
Arduino compatibility example Arduino shell example
============================= =====================
This example start a shell on merkurboard serial0 line.
You can change the network parameters and store it in eeprom.
make clean TARGET=osd-merkur-256 flash make clean TARGET=osd-merkur-256 flash
start a terminal programm
-------------------------
picocom -c -b 38400 --omap crcrlf /dev/ttyUSB0
? [ENTER]
Available commands:
?: shows this help
ccathresholds <threshold: change cca thresholds -91 to -61 dBm (default -77)
exit: exit shell
help: shows this help
kill <command>: stop a specific command
killall: stop all running commands
null: discard input
panid <0xabcd>: change panid (default 0xabcd)
ps: list all running processes
quit: exit shell
reboot: reboot the system
rfchannel <channel>: change radio channel (11 - 26)
saverfparam <> save radio parameters txpower, channel, panid to eeprom settingsmanager
txpower <power>: change transmission power 0 (3dbm, default) to 15 (-17.2dbm)
------------------------------------------------------------------------------
quit picocom, you need to press Ctrl-a , then Ctrl-q
This example shows that it is now possible to re-use arduino sketches in This example shows that it is now possible to re-use arduino sketches in
Contiki. This example documents the necessary magic. Arduino specifies Contiki. This example documents the necessary magic. Arduino specifies
two routines, `setup` and `loop`. Before `setup` is called, the two routines, `setup` and `loop`. Before `setup` is called, the

View file

@ -32,12 +32,10 @@
* Example project demonstrating the extended RF API functionality * Example project demonstrating the extended RF API functionality
*/ */
#include "contiki.h" #include "contiki.h"
#include "net/netstack.h"
#include "dev/radio.h"
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include "net/netstack.h"
#include "dev/radio.h"
#include "extended-rf-api.h" #include "extended-rf-api.h"
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
struct rf_consts { struct rf_consts {

View file

@ -38,22 +38,13 @@
*/ */
#include "contiki.h" #include "contiki.h"
#include <stdio.h>
#include <stdlib.h> /* strtol */
#include "sys/cc.h" #include "sys/cc.h"
#include "shell-sky.h"
#include "dev/watchdog.h"
#include "net/rime/rime.h"
#include "net/netstack.h"
#include "net/rime/timesynch.h"
#include "dev/radio.h" #include "dev/radio.h"
#include "sys/node-id.h" #include "shell-merkur.h"
#include "lib/settings.h"
#include "extended-rf-api.h" #include "extended-rf-api.h"
#include "params.h" #include "params.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h> /* strtol */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(shell_txpower_process, "txpower"); PROCESS(shell_txpower_process, "txpower");
@ -79,7 +70,7 @@ SHELL_COMMAND(ccathresholds_command,
PROCESS(shell_saverfparam_process, "saverfparam"); PROCESS(shell_saverfparam_process, "saverfparam");
SHELL_COMMAND(saverfparam_command, SHELL_COMMAND(saverfparam_command,
"saverfparam", "saverfparam",
"saverfparam <> save parameters txpower, channel, panid to eeprom settingsmanager", "saverfparam <> save radio parameters txpower, channel, panid to eeprom settingsmanager",
&shell_saverfparam_process); &shell_saverfparam_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -204,6 +195,8 @@ PROCESS_THREAD(shell_saverfparam_process, ev, data)
void void
shell_merkur_init(void) shell_merkur_init(void)
{ {
shell_ps_init();
shell_reboot_init();
shell_register_command(&txpower_command); shell_register_command(&txpower_command);
shell_register_command(&rfchannel_command); shell_register_command(&rfchannel_command);
shell_register_command(&ccathresholds_command); shell_register_command(&ccathresholds_command);

View file

@ -14,12 +14,8 @@ extern "C" {
#include "arduino-process.h" #include "arduino-process.h"
#include "rest-engine.h" #include "rest-engine.h"
#include "net/netstack.h" #include "net/netstack.h"
#include "lib/settings.h"
#include "shell.h"
#include "serial-shell.h" #include "serial-shell.h"
#include "shell-merkur.h" #include "shell-merkur.h"
#include "dev/radio.h"
#include "extended-rf-api.h"
extern resource_t res_led, res_battery, res_cputemp; extern resource_t res_led, res_battery, res_cputemp;
@ -35,14 +31,7 @@ void setup (void)
led_status=0; led_status=0;
// Seriell Shell // Seriell Shell
serial_shell_init(); serial_shell_init();
shell_ps_init();
shell_reboot_init();
shell_merkur_init(); shell_merkur_init();
#if COFFEE
shell_coffee_init();
shell_file_init();
#endif
// init coap resourcen // init coap resourcen
rest_init_engine (); rest_init_engine ();
#pragma GCC diagnostic ignored "-Wwrite-strings" #pragma GCC diagnostic ignored "-Wwrite-strings"

View file

@ -294,7 +294,6 @@ params_get_ccathresholds(void) {
settings_status_t settings_status_t
params_save_panid(void) { params_save_panid(void) {
radio_value_t value; radio_value_t value;
size_t size = 2;
settings_status_t rx=SETTINGS_STATUS_OK; settings_status_t rx=SETTINGS_STATUS_OK;