kopia lustrzana https://github.com/meshtastic/firmware
add frequency_offset
rodzic
2c5ea03b74
commit
c798c0032c
2
proto
2
proto
|
@ -1 +1 @@
|
||||||
Subproject commit 5cb09ec96321ce0cfae18141e5da3b75e001c9fe
|
Subproject commit 2aa14392145c38476bf61fea2c43629e1973af6d
|
|
@ -319,7 +319,7 @@ void RadioInterface::applyModemConfig()
|
||||||
// If user has manually specified a channel num, then use that, otherwise generate one by hashing the name
|
// If user has manually specified a channel num, then use that, otherwise generate one by hashing the name
|
||||||
const char *channelName = channels.getName(channels.getPrimaryIndex());
|
const char *channelName = channels.getName(channels.getPrimaryIndex());
|
||||||
int channel_num = channelSettings.channel_num ? channelSettings.channel_num - 1 : hash(channelName) % myRegion->numChannels;
|
int channel_num = channelSettings.channel_num ? channelSettings.channel_num - 1 : hash(channelName) % myRegion->numChannels;
|
||||||
freq = myRegion->freq + myRegion->spacing * channel_num;
|
freq = myRegion->freq + radioConfig.preferences.frequency_offset + myRegion->spacing * channel_num;
|
||||||
|
|
||||||
DEBUG_MSG("Set radio: name=%s, config=%u, ch=%d, power=%d\n", channelName, channelSettings.modem_config, channel_num, power);
|
DEBUG_MSG("Set radio: name=%s, config=%u, ch=%d, power=%d\n", channelName, channelSettings.modem_config, channel_num, power);
|
||||||
DEBUG_MSG("Radio myRegion->freq: %f\n", myRegion->freq);
|
DEBUG_MSG("Radio myRegion->freq: %f\n", myRegion->freq);
|
||||||
|
|
|
@ -79,7 +79,7 @@ extern const pb_msgdesc_t AdminMessage_msg;
|
||||||
#define AdminMessage_fields &AdminMessage_msg
|
#define AdminMessage_fields &AdminMessage_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define AdminMessage_size 354
|
#define AdminMessage_size 360
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -86,6 +86,7 @@ typedef struct _RadioConfig_UserPreferences {
|
||||||
bool is_low_power;
|
bool is_low_power;
|
||||||
bool fixed_position;
|
bool fixed_position;
|
||||||
bool serial_disabled;
|
bool serial_disabled;
|
||||||
|
float frequency_offset;
|
||||||
bool factory_reset;
|
bool factory_reset;
|
||||||
bool debug_log_enabled;
|
bool debug_log_enabled;
|
||||||
pb_size_t ignore_incoming_count;
|
pb_size_t ignore_incoming_count;
|
||||||
|
@ -151,9 +152,9 @@ extern "C" {
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default}
|
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default}
|
||||||
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0}
|
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0}
|
||||||
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero}
|
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero}
|
||||||
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0}
|
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_EnvironmentalMeasurementSensorType_MIN, 0, 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define RadioConfig_UserPreferences_position_broadcast_secs_tag 1
|
#define RadioConfig_UserPreferences_position_broadcast_secs_tag 1
|
||||||
|
@ -179,6 +180,7 @@ extern "C" {
|
||||||
#define RadioConfig_UserPreferences_is_low_power_tag 38
|
#define RadioConfig_UserPreferences_is_low_power_tag 38
|
||||||
#define RadioConfig_UserPreferences_fixed_position_tag 39
|
#define RadioConfig_UserPreferences_fixed_position_tag 39
|
||||||
#define RadioConfig_UserPreferences_serial_disabled_tag 40
|
#define RadioConfig_UserPreferences_serial_disabled_tag 40
|
||||||
|
#define RadioConfig_UserPreferences_frequency_offset_tag 41
|
||||||
#define RadioConfig_UserPreferences_factory_reset_tag 100
|
#define RadioConfig_UserPreferences_factory_reset_tag 100
|
||||||
#define RadioConfig_UserPreferences_debug_log_enabled_tag 101
|
#define RadioConfig_UserPreferences_debug_log_enabled_tag 101
|
||||||
#define RadioConfig_UserPreferences_ignore_incoming_tag 103
|
#define RadioConfig_UserPreferences_ignore_incoming_tag 103
|
||||||
|
@ -240,6 +242,7 @@ X(a, STATIC, SINGULAR, BOOL, is_router, 37) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, is_low_power, 38) \
|
X(a, STATIC, SINGULAR, BOOL, is_low_power, 38) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, fixed_position, 39) \
|
X(a, STATIC, SINGULAR, BOOL, fixed_position, 39) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, serial_disabled, 40) \
|
X(a, STATIC, SINGULAR, BOOL, serial_disabled, 40) \
|
||||||
|
X(a, STATIC, SINGULAR, FLOAT, frequency_offset, 41) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, factory_reset, 100) \
|
X(a, STATIC, SINGULAR, BOOL, factory_reset, 100) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 101) \
|
X(a, STATIC, SINGULAR, BOOL, debug_log_enabled, 101) \
|
||||||
X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103) \
|
X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103) \
|
||||||
|
@ -279,8 +282,8 @@ extern const pb_msgdesc_t RadioConfig_UserPreferences_msg;
|
||||||
#define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg
|
#define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define RadioConfig_size 351
|
#define RadioConfig_size 357
|
||||||
#define RadioConfig_UserPreferences_size 348
|
#define RadioConfig_UserPreferences_size 354
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -1,37 +1,21 @@
|
||||||
#include "CryptoEngine.h"
|
#include "CryptoEngine.h"
|
||||||
#include "target_specific.h"
|
|
||||||
#include "PortduinoGPIO.h"
|
#include "PortduinoGPIO.h"
|
||||||
#include "mesh/RF95Interface.h"
|
#include "mesh/RF95Interface.h"
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
|
#include "target_specific.h"
|
||||||
|
|
||||||
#include <Utility.h>
|
#include <Utility.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
// FIXME - move getMacAddr/setBluetoothEnable into a HALPlatform class
|
// FIXME - move setBluetoothEnable into a HALPlatform class
|
||||||
|
|
||||||
uint32_t hwId; // fixme move into portduino
|
|
||||||
|
|
||||||
void getMacAddr(uint8_t *dmac)
|
|
||||||
{
|
|
||||||
if (!hwId) {
|
|
||||||
notImplemented("getMacAddr");
|
|
||||||
hwId = random();
|
|
||||||
}
|
|
||||||
|
|
||||||
dmac[0] = 0x80;
|
|
||||||
dmac[1] = 0;
|
|
||||||
dmac[2] = 0;
|
|
||||||
dmac[3] = hwId >> 16;
|
|
||||||
dmac[4] = hwId >> 8;
|
|
||||||
dmac[5] = hwId & 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setBluetoothEnable(bool on)
|
void setBluetoothEnable(bool on)
|
||||||
{
|
{
|
||||||
// not needed
|
// not needed
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpuDeepSleep(uint64_t msecs) {
|
void cpuDeepSleep(uint64_t msecs)
|
||||||
|
{
|
||||||
notImplemented("cpuDeepSleep");
|
notImplemented("cpuDeepSleep");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +44,15 @@ void updateBatteryLevel(uint8_t level) NOT_IMPLEMENTED("updateBatteryLevel");
|
||||||
*
|
*
|
||||||
* Porduino helper class to do this i2c based polling:
|
* Porduino helper class to do this i2c based polling:
|
||||||
*/
|
*/
|
||||||
class R595PolledIrqPin : public GPIOPin {
|
class R595PolledIrqPin : public GPIOPin
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
R595PolledIrqPin() : GPIOPin(LORA_DIO0, "LORA_DIO0") {}
|
R595PolledIrqPin() : GPIOPin(LORA_DIO0, "LORA_DIO0") {}
|
||||||
|
|
||||||
/// Read the low level hardware for this pin
|
/// Read the low level hardware for this pin
|
||||||
virtual PinStatus readPinHardware()
|
virtual PinStatus readPinHardware()
|
||||||
{
|
{
|
||||||
if(isrPinStatus < 0)
|
if (isrPinStatus < 0)
|
||||||
return LOW; // No interrupt handler attached, don't bother polling i2c right now
|
return LOW; // No interrupt handler attached, don't bother polling i2c right now
|
||||||
else {
|
else {
|
||||||
extern RadioInterface *rIf; // FIXME, temporary hack until we know if we need to keep this
|
extern RadioInterface *rIf; // FIXME, temporary hack until we know if we need to keep this
|
||||||
|
@ -81,17 +66,17 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** apps run under portduino can optionally define a portduinoSetup() to
|
/** apps run under portduino can optionally define a portduinoSetup() to
|
||||||
* use portduino specific init code (such as gpioBind) to setup portduino on their host machine,
|
* use portduino specific init code (such as gpioBind) to setup portduino on their host machine,
|
||||||
* before running 'arduino' code.
|
* before running 'arduino' code.
|
||||||
*/
|
*/
|
||||||
void portduinoSetup() {
|
void portduinoSetup()
|
||||||
printf("Setting up Meshtastic on Porduino...\n");
|
{
|
||||||
|
printf("Setting up Meshtastic on Porduino...\n");
|
||||||
|
|
||||||
// FIXME: disable while not testing with real hardware
|
// FIXME: disable while not testing with real hardware
|
||||||
// gpioBind(new R595PolledIrqPin());
|
// gpioBind(new R595PolledIrqPin());
|
||||||
|
|
||||||
// gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET")));
|
// gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET")));
|
||||||
// gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent());
|
// gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent());
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue