Merge pull request #1337 from mc-hamster/location

Added new roles
pull/1338/head
Jm Casler 2022-03-29 22:03:06 -07:00 zatwierdzone przez GitHub
commit da87c15d0b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 40 dodań i 16 usunięć

Wyświetl plik

@ -32,14 +32,19 @@ void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
if ((p->to == NODENUM_BROADCAST) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
if (p->id != 0) {
MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
if (radioConfig.preferences.role != Role_ClientMute) {
MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
tosend->hop_limit--; // bump down the hop count
tosend->hop_limit--; // bump down the hop count
printPacket("Rebroadcasting received floodmsg to neighbors", p);
// Note: we are careful to resend using the original senders node id
// We are careful not to call our hooked version of send() - because we don't want to check this again
Router::send(tosend);
printPacket("Rebroadcasting received floodmsg to neighbors", p);
// Note: we are careful to resend using the original senders node id
// We are careful not to call our hooked version of send() - because we don't want to check this again
Router::send(tosend);
} else {
DEBUG_MSG("Not rebroadcasting. Role = Role_ClientMute\n");
}
} else {
DEBUG_MSG("Ignoring a simple (0 id) broadcast\n");

Wyświetl plik

@ -202,7 +202,7 @@ uint32_t RadioInterface::getTxDelayMsecWeighted(float snr)
// low SNR = Short Delay
uint32_t delay = 0;
if (radioConfig.preferences.role == Role_Router) {
if (radioConfig.preferences.role == Role_Router || radioConfig.preferences.role == Role_RouterClient) {
delay = map(snr, SNR_MIN, SNR_MAX, MIN_TX_WAIT_MSEC, (MIN_TX_WAIT_MSEC + (shortPacketMsec / 2)));
DEBUG_MSG("rx_snr found in packet. As a router, setting tx delay:%d\n", delay);
} else {

Wyświetl plik

@ -51,10 +51,23 @@ typedef enum _RegionCode {
Router
Functions as a router */
typedef enum _Role {
/* Default device role */
Role_Default = 0,
/* Router device role */
Role_Router = 1
/* Client device role */
Role_Client = 0,
/* ClientMute device role
This is like the client but packets will not hop over this node. Would be
useful if you want to save power by not contributing to the mesh. */
Role_ClientMute = 1,
/* Router device role.
Uses an agressive algirithem for the flood networking so packets will
prefer to be routed over this node. Also assume that this will be generally
unattended and so will turn off the wifi/ble radio as well as the oled screen. */
Role_Router = 2,
/* RouterClient device role
Uses an agressive algirithem for the flood networking so packets will
prefer to be routed over this node. Similiar power management as a regular
client, so the RouterClient can be used as both a Router and a Client. Useful
as a well placed base station that you could also use to send messages. */
Role_RouterClient = 3
} Role;
/* Sets the charge control current of devices with a battery charger that can be
@ -206,10 +219,16 @@ typedef enum _RadioConfig_UserPreferences_Serial_Baud {
Router
Functions as a router */
typedef enum _RadioConfig_UserPreferences_Serial_Mode {
/* Default device role */
/* Client device role */
RadioConfig_UserPreferences_Serial_Mode_MODE_Default = 0,
/* Router device role */
/* ClientMute device role
This is like the client but packets will not hop over this node. Would be
useful if you want to save power by not contributing to the mesh. */
RadioConfig_UserPreferences_Serial_Mode_MODE_SIMPLE = 1,
/* Router device role.
Uses an agressive algirithem for the flood networking so packets will
prefer to be routed over this node. Also assume that this will be generally
unattended and so will turn off the wifi/ble radio as well as the oled screen. */
RadioConfig_UserPreferences_Serial_Mode_MODE_PROTO = 2
} RadioConfig_UserPreferences_Serial_Mode;
@ -343,9 +362,9 @@ typedef struct _RadioConfig {
#define _RegionCode_MAX RegionCode_TH
#define _RegionCode_ARRAYSIZE ((RegionCode)(RegionCode_TH+1))
#define _Role_MIN Role_Default
#define _Role_MAX Role_Router
#define _Role_ARRAYSIZE ((Role)(Role_Router+1))
#define _Role_MIN Role_Client
#define _Role_MAX Role_RouterClient
#define _Role_ARRAYSIZE ((Role)(Role_RouterClient+1))
#define _ChargeCurrent_MIN ChargeCurrent_MAUnset
#define _ChargeCurrent_MAX ChargeCurrent_MA1320