diff --git a/Makefile b/Makefile index fb1616c..7098cfb 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,8 @@ MCU = atmega328p F_CPU = 8000000 BAUD = 9600 PROGRAMMER_TYPE = avrispmkII -PROGRAMMER_ARGS = +# PROGRAMMER_TYPE = atmelice_isp +PROGRAMMER_ARGS = -B 125kHz # Supported RFM radio module variants: 69 and 95 RFM = 95 diff --git a/avrrfm.c b/avrrfm.c index 23a97ff..8e409aa 100644 --- a/avrrfm.c +++ b/avrrfm.c @@ -272,6 +272,7 @@ static void receiveTemp(void) { rfmLoRaRxRead(payload, sizeof (payload)); Temperature temp = readTemp(payload); + rfmSetOutputPower(temp.power); uint8_t response[] = {flags.rssi}; rfmLoRaTx(response, sizeof (response)); @@ -285,6 +286,7 @@ static void receiveTemp(void) { rfmReadPayload(payload, sizeof (payload)); Temperature temp = readTemp(payload); + rfmSetOutputPower(temp.power); uint8_t response[] = {flags.rssi}; rfmTransmitPayload(response, sizeof (response), NODE2); @@ -349,9 +351,6 @@ int main(void) { initWatchdog(); } - // enable global interrupts - sei(); - printString("Hello Radio!\r\n"); uint8_t node = RECEIVER ? NODE1 : NODE2; @@ -374,6 +373,9 @@ int main(void) { } } + // enable global interrupts + sei(); + while (true) { if (radio) { if (!RECEIVER) {