Nodes now calculate their coordinates. But the code now only wirks with triangles.

This commit is contained in:
2021-01-08 20:33:58 +01:00
parent d966d2ef8e
commit 2715d5aa6a
5 changed files with 30 additions and 35 deletions

View File

@ -33,7 +33,7 @@ bool looping;
void setup_layout() {
LOGln("Setting up layout...");
uint8_t layout[] = LAYOUT;
Node* current_node = new Node(0);
Node* current_node = new Node(0, {0, 0}, 0);
nodes.push_back(current_node);
for(uint16_t i=0; i<NODE_COUNT-1; i++) {
@ -82,21 +82,6 @@ void setup_fastled() {
set_all_leds(CRGB::Black);
}
void setup_rng() {
LOGln("Starting WiFi scan for RNG initialization...");
WiFi.mode(WIFI_STA);
WiFi.disconnect();
uint16_t seed = 0;
int n = WiFi.scanNetworks();
LOGln("%d WiFi networks found", n);
for(int i=0; i<n; i++) {
LOGln(" %s, %d dB", WiFi.SSID(i).c_str(), WiFi.RSSI(i));
seed = (seed << 2) | (WiFi.RSSI(i) & 0x03);
}
LOGln("WiFi scan done. Generated seed is 0x%04x", seed);
random16_set_seed(seed);
}
void setup() {
Serial.begin(74880);
LOGln("ESPleaf starting.");
@ -106,8 +91,6 @@ void setup() {
#ifdef TEST_MODE
LOGln("TEST_MODE is active!");
#else
setup_rng();
wifi_setup();
mqtt_setup();
ArduinoOTA.setHostname(OTA_HOSTNAME);