From abdd1c4292b6a8c15b2ac624124d6617c5781161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20R=C3=B6mer?= Date: Fri, 16 May 2025 00:54:20 +0200 Subject: [PATCH] Enable global interrupts after initialization + receiver responds with output power reported by transmitter instead of +17 dBm + introduce Atmel ICE --- Makefile | 3 ++- avrrfm.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) 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) {