sforkowany z mirror/meshtastic-firmware
begin support for countries besides the US
rodzic
b03f7b4940
commit
bf491efddf
3
TODO.md
3
TODO.md
|
@ -2,6 +2,8 @@
|
|||
Items to complete before the first alpha release.
|
||||
|
||||
* post sample video to signal forum
|
||||
* support non US frequencies
|
||||
* make an install script to let novices install software on their boards
|
||||
* retest BLE software update for both board types
|
||||
* default to enter deep sleep if no LORA received for two hours (indicates user has probably left the meshS)
|
||||
* first alpha release, article writeup for hackaday
|
||||
|
@ -35,6 +37,7 @@ Items to complete before the first beta release.
|
|||
# Low power consumption tasks
|
||||
General ideas to hit the power draws our spreadsheet predicts. Do the easy ones before beta, the last 15% can be done after 1.0.
|
||||
|
||||
* lower BT announce interval to save battery
|
||||
* change to use RXcontinuous mode and config to drop packets with bad CRC (see section 6.4 of datasheet)
|
||||
* we currently poll the lora radio from loop(), which is really bad because it means we run loop every 10ms. Instead have the rf95 driver enqueue received messages from the ISR.
|
||||
* platformio sdkconfig CONFIG_PM and turn on modem sleep mode
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
set -e
|
||||
|
||||
VERSION=0.0.2
|
||||
VERSION=0.0.3
|
||||
|
||||
COUNTRY=US
|
||||
|
||||
rm .pio/build/esp32/firmware.bin
|
||||
export PLATFORMIO_BUILD_FLAGS="-DT_BEAM_V10 -DAPP_VERSION=$VERSION"
|
||||
pio run # -v
|
||||
cp .pio/build/esp32/firmware.bin release/firmware-TBEAM-US.bin
|
||||
cp .pio/build/esp32/firmware.bin release/firmware-TBEAM-$COUNTRY.bin
|
||||
|
||||
rm .pio/build/esp32/firmware.bin
|
||||
export PLATFORMIO_BUILD_FLAGS="-DHELTEC_LORA32 -DAPP_VERSION=$VERSION"
|
||||
pio run # -v
|
||||
cp .pio/build/esp32/firmware.bin release/firmware-HELTEC-US.bin
|
||||
cp .pio/build/esp32/firmware.bin release/firmware-HELTEC-$COUNTRY.bin
|
|
@ -15,7 +15,7 @@ static BLECharacteristic HardwareVersionCharacteristic(BLEUUID((uint16_t)ESP_GAT
|
|||
/**
|
||||
* Create standard device info service
|
||||
**/
|
||||
BLEService *createDeviceInfomationService(BLEServer *server, std::string hwVendor, std::string swVersion, std::string hwVersion)
|
||||
BLEService *createDeviceInfomationService(BLEServer *server, std::string hwVendor, std::string swVersion, std::string hwVersion = "")
|
||||
{
|
||||
BLEService *deviceInfoService = server->createService(BLEUUID((uint16_t)ESP_GATT_UUID_DEVICE_INFO_SVC));
|
||||
|
||||
|
@ -32,8 +32,11 @@ BLEService *createDeviceInfomationService(BLEServer *server, std::string hwVendo
|
|||
deviceInfoService->addCharacteristic(&SWVersionCharacteristic);
|
||||
ManufacturerCharacteristic.setValue(hwVendor);
|
||||
deviceInfoService->addCharacteristic(&ManufacturerCharacteristic);
|
||||
HardwareVersionCharacteristic.setValue(hwVersion);
|
||||
deviceInfoService->addCharacteristic(&HardwareVersionCharacteristic);
|
||||
if (!hwVersion.empty())
|
||||
{
|
||||
HardwareVersionCharacteristic.setValue(hwVersion);
|
||||
deviceInfoService->addCharacteristic(&HardwareVersionCharacteristic);
|
||||
}
|
||||
//SerialNumberCharacteristic.setValue("FIXME");
|
||||
//deviceInfoService->addCharacteristic(&SerialNumberCharacteristic);
|
||||
|
||||
|
|
|
@ -18,4 +18,4 @@ void dumpCharacteristic(BLECharacteristic *c);
|
|||
uint32_t getValue32(BLECharacteristic *c, uint32_t defaultValue);
|
||||
|
||||
void loopBLE();
|
||||
BLEServer *initBLE(std::string devName, std::string hwVendor, std::string swVersion, std::string hwVersion);
|
||||
BLEServer *initBLE(std::string devName, std::string hwVendor, std::string swVersion, std::string hwVersion = "");
|
|
@ -33,9 +33,11 @@ MeshRadio::MeshRadio(MemoryPool<MeshPacket> &_pool, PointerQueue<MeshPacket> &_r
|
|||
rxDest(_rxDest),
|
||||
txQueue(MAX_TX_QUEUE)
|
||||
{
|
||||
myNodeInfo.num_channels = NUM_CHANNELS;
|
||||
|
||||
//radioConfig.modem_config = RadioConfig_ModemConfig_Bw125Cr45Sf128; // medium range and fast
|
||||
channelSettings.modem_config = ChannelSettings_ModemConfig_Bw500Cr45Sf128; // short range and fast, but wide bandwidth so incompatible radios can talk together
|
||||
//radioConfig.modem_config = RadioConfig_ModemConfig_Bw125Cr48Sf4096; // slow and long range
|
||||
//channelSettings.modem_config = ChannelSettings_ModemConfig_Bw500Cr45Sf128; // short range and fast, but wide bandwidth so incompatible radios can talk together
|
||||
channelSettings.modem_config = ChannelSettings_ModemConfig_Bw125Cr48Sf4096; // slow and long range
|
||||
|
||||
channelSettings.tx_power = 23;
|
||||
channelSettings.channel_num = DEFAULT_CHANNEL_NUM;
|
||||
|
|
|
@ -11,12 +11,43 @@
|
|||
// US channel settings
|
||||
#define CH0_US 903.08f // MHz
|
||||
#define CH_SPACING_US 2.16f // MHz
|
||||
#define NUM_CHANNELS_US 13
|
||||
|
||||
// EU channel settings
|
||||
#define CH0_EU 865.2f // MHz
|
||||
#define CH_SPACING_EU 0.3f // MHz
|
||||
#define NUM_CHANNELS_EU 10
|
||||
|
||||
// CN channel settings
|
||||
#define CH0_CN 470f // MHz
|
||||
#define CH_SPACING_CN 2.0f // MHz FIXME, this is just a guess for 470-510
|
||||
#define NUM_CHANNELS_CN 20
|
||||
|
||||
// CN channel settings
|
||||
#define CH0_JP 920f // MHz
|
||||
#define CH_SPACING_JP 0.5f // MHz FIXME, this is just a guess for 920-925
|
||||
#define NUM_CHANNELS_JP 10
|
||||
|
||||
// FIXME add defs for other regions and use them here
|
||||
#ifdef HW_VERSION_US
|
||||
#define CH0 CH0_US
|
||||
#define CH_SPACING CH_SPACING_US
|
||||
#define NUM_CHANNELS Constants_NumChannels
|
||||
|
||||
#define NUM_CHANNELS NUM_CHANNELS_US
|
||||
#elif defined(HW_VERSION_EU)
|
||||
#define CH0 CH0_EU
|
||||
#define CH_SPACING CH_SPACING_EU
|
||||
#define NUM_CHANNELS NUM_CHANNELS_EU
|
||||
#elif defined(HW_VERSION_CN)
|
||||
#define CH0 CH0_CN
|
||||
#define CH_SPACING CH_SPACING_CN
|
||||
#define NUM_CHANNELS NUM_CHANNELS_CN
|
||||
#elif defined(HW_VERSION_JP)
|
||||
#define CH0 CH0_JP
|
||||
#define CH_SPACING CH_SPACING_JP
|
||||
#define NUM_CHANNELS NUM_CHANNELS_JP
|
||||
#else
|
||||
#error "HW_VERSION not set"
|
||||
#endif
|
||||
|
||||
#define MAX_TX_QUEUE 8 // max number of packets which can be waiting for transmission
|
||||
|
||||
|
|
|
@ -30,10 +30,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define APP_NAME "Meshtastic"
|
||||
|
||||
// If app version is not specified we assume we are not being invoked by the build script
|
||||
#ifndef APP_VERSION
|
||||
#define APP_VERSION "0.0.0"
|
||||
#define APP_VERSION "0.0.0" // this def normally comes from build-all.sh
|
||||
#endif
|
||||
#define HW_VERSION "US" // We encode the hardware freq range in the hw version string, so sw update can eventually install the correct build
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Configuration
|
||||
|
@ -41,8 +43,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
// Select which board is being used. If the outside build environment has sent a choice, just use that
|
||||
#if !defined(T_BEAM_V10) && !defined(HELTEC_LORA32)
|
||||
//#define T_BEAM_V10 // AKA Rev1 (second board released)
|
||||
#define HELTEC_LORA32
|
||||
#define T_BEAM_V10 // AKA Rev1 (second board released)
|
||||
//#define HELTEC_LORA32
|
||||
|
||||
#define HW_VERSION_US // We encode the hardware freq range in the hw version string, so sw update can eventually install the correct build
|
||||
#endif
|
||||
|
||||
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
|
||||
|
|
|
@ -402,7 +402,7 @@ void setup()
|
|||
if (useBluetooth)
|
||||
{
|
||||
DEBUG_MSG("Starting bluetooth\n");
|
||||
BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, APP_VERSION, HW_VERSION); // FIXME, use a real name based on the macaddr
|
||||
BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, APP_VERSION); // FIXME, use a real name based on the macaddr
|
||||
createMeshBluetoothService(serve);
|
||||
|
||||
// Start advertising - this must be done _after_ creating all services
|
||||
|
|
|
@ -15,8 +15,7 @@ extern "C" {
|
|||
|
||||
/* Enum definitions */
|
||||
typedef enum _Constants {
|
||||
Constants_Unused = 0,
|
||||
Constants_NumChannels = 13
|
||||
Constants_Unused = 0
|
||||
} Constants;
|
||||
|
||||
typedef enum _Data_Type {
|
||||
|
@ -34,8 +33,8 @@ typedef enum _ChannelSettings_ModemConfig {
|
|||
|
||||
typedef enum _DeviceState_Version {
|
||||
DeviceState_Version_Unset = 0,
|
||||
DeviceState_Version_Minimum = 12,
|
||||
DeviceState_Version_Current = 12
|
||||
DeviceState_Version_Minimum = 13,
|
||||
DeviceState_Version_Current = 13
|
||||
} DeviceState_Version;
|
||||
|
||||
/* Struct definitions */
|
||||
|
@ -56,6 +55,7 @@ typedef struct _Data {
|
|||
typedef struct _MyNodeInfo {
|
||||
int32_t my_node_num;
|
||||
bool has_gps;
|
||||
int32_t num_channels;
|
||||
} MyNodeInfo;
|
||||
|
||||
typedef struct _Position {
|
||||
|
@ -149,8 +149,8 @@ typedef struct _ToRadio {
|
|||
|
||||
/* Helper constants for enums */
|
||||
#define _Constants_MIN Constants_Unused
|
||||
#define _Constants_MAX Constants_NumChannels
|
||||
#define _Constants_ARRAYSIZE ((Constants)(Constants_NumChannels+1))
|
||||
#define _Constants_MAX Constants_Unused
|
||||
#define _Constants_ARRAYSIZE ((Constants)(Constants_Unused+1))
|
||||
|
||||
#define _Data_Type_MIN Data_Type_SIGNAL_OPAQUE
|
||||
#define _Data_Type_MAX Data_Type_CLEAR_READACK
|
||||
|
@ -175,7 +175,7 @@ typedef struct _ToRadio {
|
|||
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default}
|
||||
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0}
|
||||
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0, 0}
|
||||
#define MyNodeInfo_init_default {0, 0}
|
||||
#define MyNodeInfo_init_default {0, 0, 0}
|
||||
#define DeviceState_init_default {false, RadioConfig_init_default, false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default}, _DeviceState_Version_MIN, false, MeshPacket_init_default}
|
||||
#define FromRadio_init_default {0, 0, {MeshPacket_init_default}}
|
||||
#define ToRadio_init_default {0, {MeshPacket_init_default}}
|
||||
|
@ -188,7 +188,7 @@ typedef struct _ToRadio {
|
|||
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero}
|
||||
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0}
|
||||
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0, 0}
|
||||
#define MyNodeInfo_init_zero {0, 0}
|
||||
#define MyNodeInfo_init_zero {0, 0, 0}
|
||||
#define DeviceState_init_zero {false, RadioConfig_init_zero, false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero}, _DeviceState_Version_MIN, false, MeshPacket_init_zero}
|
||||
#define FromRadio_init_zero {0, 0, {MeshPacket_init_zero}}
|
||||
#define ToRadio_init_zero {0, {MeshPacket_init_zero}}
|
||||
|
@ -203,6 +203,7 @@ typedef struct _ToRadio {
|
|||
#define Data_payload_tag 2
|
||||
#define MyNodeInfo_my_node_num_tag 1
|
||||
#define MyNodeInfo_has_gps_tag 2
|
||||
#define MyNodeInfo_num_channels_tag 3
|
||||
#define Position_latitude_tag 1
|
||||
#define Position_longitude_tag 2
|
||||
#define Position_altitude_tag 3
|
||||
|
@ -324,7 +325,8 @@ X(a, STATIC, SINGULAR, INT32, frequency_error, 6)
|
|||
|
||||
#define MyNodeInfo_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, INT32, my_node_num, 1) \
|
||||
X(a, STATIC, SINGULAR, BOOL, has_gps, 2)
|
||||
X(a, STATIC, SINGULAR, BOOL, has_gps, 2) \
|
||||
X(a, STATIC, SINGULAR, INT32, num_channels, 3)
|
||||
#define MyNodeInfo_CALLBACK NULL
|
||||
#define MyNodeInfo_DEFAULT NULL
|
||||
|
||||
|
@ -397,8 +399,8 @@ extern const pb_msgdesc_t ToRadio_msg;
|
|||
#define RadioConfig_size 72
|
||||
#define RadioConfig_UserPreferences_size 18
|
||||
#define NodeInfo_size 157
|
||||
#define MyNodeInfo_size 13
|
||||
#define DeviceState_size 14954
|
||||
#define MyNodeInfo_size 24
|
||||
#define DeviceState_size 14965
|
||||
#define FromRadio_size 299
|
||||
#define ToRadio_size 293
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue