/** * @brief Sends a reset command to the module * Also sets-up some initial parameters like power index, SF and FSB channels. * @return Waits for sucess reponse or timeout. */ bool RN2483::resetDevice() { printf("RN2483: Reset\n"); _RN2483.printf(STR_CMD_RESET); _RN2483.printf(CRLF); if (expectString(STR_DEVICE_TYPE_RN, 2000)) { if (strstr(this->inputBuffer, STR_DEVICE_TYPE_RN2483) != NULL) { isRN2903 = false; return setPowerIndex(DEFAULT_PWR_IDX_868) && setSpreadingFactor(DEFAULT_SF_868); } else if (strstr(this->inputBuffer, STR_DEVICE_TYPE_RN2903) != NULL) { // TODO move into init once it is decided how to handle RN2903-specific operations isRN2903 = true; return setFsbChannels(DEFAULT_FSB) && setPowerIndex(DEFAULT_PWR_IDX_915) && setSpreadingFactor(DEFAULT_SF_915); } else { return false; } } return false; }
void LoRa::init(LORA_MODE desiredMode){ config->build(desiredMode); resetConfig(); setPublicNetwork(); setFrequencySubBand(); setNetworkName(); setNetworkPassphrase(); setSpreadingFactor(); setAckRetries(); setTxPower(); saveConfig(); if(config->isActiv()){ joinNetwork(); } }