kopia lustrzana https://github.com/meshtastic/firmware
Merge pull request #1226 from mc-hamster/group-chat
Fix webserver crash with new filesystem & Add groups to payloadVariantpull/1230/head
commit
7b2042f391
|
@ -140,11 +140,18 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||
myNodeInfo.has_gps = gps && gps->isConnected(); // Update with latest GPS connect info
|
||||
fromRadioScratch.which_payloadVariant = FromRadio_my_info_tag;
|
||||
fromRadioScratch.my_info = myNodeInfo;
|
||||
state = STATE_SEND_NODEINFO;
|
||||
state = STATE_SEND_GROUPS;
|
||||
|
||||
service.refreshMyNodeInfo(); // Update my NodeInfo because the client will be asking for it soon.
|
||||
break;
|
||||
|
||||
case STATE_SEND_GROUPS:
|
||||
fromRadioScratch.which_payloadVariant = FromRadio_groups_tag;
|
||||
fromRadioScratch.groups = ourGroupInfo;
|
||||
state = STATE_SEND_NODEINFO;
|
||||
|
||||
break;
|
||||
|
||||
case STATE_SEND_NODEINFO: {
|
||||
const NodeInfo *info = nodeInfoForPhone;
|
||||
nodeInfoForPhone = NULL; // We just consumed a nodeinfo, will need a new one next time
|
||||
|
|
|
@ -24,6 +24,7 @@ class PhoneAPI
|
|||
STATE_SEND_NOTHING, // (Eventual) Initial state, don't send anything until the client starts asking for config
|
||||
// (disconnected)
|
||||
STATE_SEND_MY_INFO, // send our my info record
|
||||
STATE_SEND_GROUPS,
|
||||
// STATE_SEND_RADIO, // in 1.2 we now send this as a regular mesh packet
|
||||
// STATE_SEND_OWNER, no need to send Owner specially, it is just part of the nodedb
|
||||
STATE_SEND_NODEINFO, // states progress in this order as the device sends to to the client
|
||||
|
|
|
@ -275,6 +275,7 @@ typedef struct _FromRadio {
|
|||
uint32_t config_complete_id;
|
||||
bool rebooted;
|
||||
MeshPacket packet;
|
||||
GroupInfo groups;
|
||||
};
|
||||
} FromRadio;
|
||||
|
||||
|
@ -459,6 +460,7 @@ extern "C" {
|
|||
#define FromRadio_config_complete_id_tag 8
|
||||
#define FromRadio_rebooted_tag 9
|
||||
#define FromRadio_packet_tag 11
|
||||
#define FromRadio_groups_tag 12
|
||||
#define ToRadio_packet_tag 2
|
||||
#define ToRadio_peer_info_tag 3
|
||||
#define ToRadio_want_config_id_tag 100
|
||||
|
@ -603,13 +605,15 @@ X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,node_info,node_info), 4) \
|
|||
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,log_record,log_record), 7) \
|
||||
X(a, STATIC, ONEOF, UINT32, (payloadVariant,config_complete_id,config_complete_id), 8) \
|
||||
X(a, STATIC, ONEOF, BOOL, (payloadVariant,rebooted,rebooted), 9) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11)
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 11) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,groups,groups), 12)
|
||||
#define FromRadio_CALLBACK NULL
|
||||
#define FromRadio_DEFAULT NULL
|
||||
#define FromRadio_payloadVariant_my_info_MSGTYPE MyNodeInfo
|
||||
#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo
|
||||
#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord
|
||||
#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket
|
||||
#define FromRadio_payloadVariant_groups_MSGTYPE GroupInfo
|
||||
|
||||
#define ToRadio_FIELDLIST(X, a) \
|
||||
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,packet), 2) \
|
||||
|
|
|
@ -390,6 +390,9 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
res->println("Web server is running.<br><br>The content you are looking for can't be found. Please see: <a "
|
||||
"href=https://meshtastic.org/docs/getting-started/faq#wifi--web-browser>FAQ</a>.<br><br><a "
|
||||
"href=/admin>admin</a>");
|
||||
|
||||
return;
|
||||
|
||||
} else {
|
||||
res->setHeader("Content-Encoding", "gzip");
|
||||
}
|
||||
|
@ -427,6 +430,7 @@ void handleStatic(HTTPRequest *req, HTTPResponse *res)
|
|||
return;
|
||||
|
||||
} else {
|
||||
DEBUG_MSG("ERROR: This should not have happened...\n");
|
||||
res->println("ERROR: This should not have happened...");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,13 @@ int32_t GroupPlugin::runOnce()
|
|||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||
|
||||
|
||||
//ourGroupInfo.group[0][1] = "a";
|
||||
//ourGroupInfo.group[0] = "20";
|
||||
//ourGroupInfo.group_count;
|
||||
sprintf(ourGroupInfo.group[0], "Group 0");
|
||||
sprintf(ourGroupInfo.group[1], "Group 1");
|
||||
sprintf(ourGroupInfo.group[2], "Group 2");
|
||||
sprintf(ourGroupInfo.group[3], "Group 3");
|
||||
sprintf(ourGroupInfo.group[4], "Group 4");
|
||||
|
||||
return 5000; // to save power only wake for our callback occasionally
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue