bugix read tx power
This commit is contained in:
parent
4127d0993b
commit
df2b297d91
5 changed files with 62 additions and 7 deletions
|
@ -45,6 +45,11 @@ txpower <power>: change transmission power 0 (3dbm, default) to 15 (-17.2dbm)
|
|||
------------------------------------------------------------------------------
|
||||
quit picocom, you need to press Ctrl-a , then Ctrl-q
|
||||
------------------------------------------------------------------------------
|
||||
Read eeprom to disk:
|
||||
avrdude -p m256rfr2 -c stk500v2 -P /dev/ttyUSB0 -b 57600 -U eeprom:r:eeprom_img.hex:i
|
||||
Write eeprom to Merkurboard:
|
||||
avrdude -p m256rfr2 -c stk500v2 -P /dev/ttyUSB0 -b 57600 -U eeprom:w:eeprom_img.hex:i
|
||||
|
||||
todo:
|
||||
|
||||
bugfix: txpower <power>: change transmission power 0 (3dbm, default) to 15 (-17.2dbm)
|
||||
|
|
|
@ -46,6 +46,7 @@ struct rf_consts {
|
|||
};
|
||||
|
||||
static struct rf_consts consts;
|
||||
static radio_value_t tmpv;
|
||||
|
||||
void
|
||||
print_64bit_addr(const uint8_t *addr)
|
||||
|
@ -115,9 +116,12 @@ radio_result_t
|
|||
get_param(radio_param_t param, radio_value_t *value)
|
||||
{
|
||||
radio_result_t rv;
|
||||
|
||||
rv = NETSTACK_RADIO.get_value(param, value);
|
||||
|
||||
if(param == RADIO_PARAM_TXPOWER){
|
||||
value = tmpv;
|
||||
rv = RADIO_RESULT_OK;
|
||||
} else {
|
||||
rv = NETSTACK_RADIO.get_value(param, value);
|
||||
}
|
||||
switch(rv) {
|
||||
case RADIO_RESULT_ERROR:
|
||||
printf("Radio returned an error\n");
|
||||
|
@ -142,7 +146,9 @@ radio_result_t
|
|||
set_param(radio_param_t param, radio_value_t value)
|
||||
{
|
||||
radio_result_t rv;
|
||||
|
||||
if(param == RADIO_PARAM_TXPOWER){
|
||||
tmpv = value;
|
||||
}
|
||||
rv = NETSTACK_RADIO.set_value(param, value);
|
||||
|
||||
switch(rv) {
|
||||
|
|
|
@ -37,7 +37,9 @@
|
|||
#define PLATFORM_HAS_BATTERY 1
|
||||
|
||||
|
||||
#define LOOP_INTERVAL (30 * CLOCK_SECOND)
|
||||
#define LOOP_INTERVAL (20 * CLOCK_SECOND)
|
||||
|
||||
//#define SETTINGS_MAX_SIZE 255
|
||||
|
||||
/* Save energy */
|
||||
//#define RDC_CONF_PT_YIELD_OFF
|
||||
|
|
|
@ -85,10 +85,10 @@ PROCESS_THREAD(shell_txpower_process, ev, data)
|
|||
|
||||
/* If no transmission power was given on the command line, we print
|
||||
out the current txpower. */
|
||||
if(newptr == data) {
|
||||
if(newptr == data) {
|
||||
if(get_param(RADIO_PARAM_TXPOWER, &value) == RADIO_RESULT_OK) {
|
||||
|
||||
}
|
||||
// value = params_get_txpower();
|
||||
} else {
|
||||
set_param(RADIO_PARAM_TXPOWER, value);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ extern "C" {
|
|||
#include "serial-shell.h"
|
||||
#include "shell-merkur.h"
|
||||
|
||||
#include "lib/settings.h"
|
||||
|
||||
extern resource_t res_led, res_battery, res_cputemp;
|
||||
|
||||
uint8_t led_pin=4;
|
||||
|
@ -25,6 +27,8 @@ uint8_t led_status;
|
|||
|
||||
void setup (void)
|
||||
{
|
||||
settings_status_t status;
|
||||
|
||||
// switch off the led
|
||||
pinMode(led_pin, OUTPUT);
|
||||
digitalWrite(led_pin, HIGH);
|
||||
|
@ -46,6 +50,44 @@ void setup (void)
|
|||
|
||||
void loop (void)
|
||||
{
|
||||
int i;
|
||||
settings_iter_t iter;
|
||||
char hostname[30];
|
||||
uint16_t panid;
|
||||
uint16_t channel;
|
||||
|
||||
/*************************************************************************/
|
||||
/* Iterating thru all settings */
|
||||
|
||||
for(iter = settings_iter_begin(); iter; iter = settings_iter_next(iter)) {
|
||||
settings_length_t len = settings_iter_get_value_length(iter);
|
||||
eeprom_addr_t addr = settings_iter_get_value_addr(iter);
|
||||
uint8_t byte;
|
||||
|
||||
union {
|
||||
settings_key_t key;
|
||||
char bytes[0];
|
||||
} u;
|
||||
|
||||
u.key = settings_iter_get_key(iter);
|
||||
|
||||
if(u.bytes[0] >= 32 && u.bytes[0] < 127
|
||||
&& u.bytes[1] >= 32 && u.bytes[1] < 127
|
||||
) {
|
||||
printf("settings-example: [%c%c] = <",u.bytes[0],u.bytes[1]);
|
||||
} else {
|
||||
printf("settings-example: <0x%04X> = <",u.key);
|
||||
}
|
||||
|
||||
for(; len; len--, addr++) {
|
||||
eeprom_read(addr, &byte, 1);
|
||||
printf("%02X", byte);
|
||||
if(len != 1) {
|
||||
printf(" ");
|
||||
}
|
||||
}
|
||||
|
||||
printf(">\n");
|
||||
}
|
||||
printf("settings-example: Done.\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue