Skip to content

Commit

Permalink
dutycycle bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Praneethsvch committed Oct 14, 2021
1 parent 47b95f7 commit 0db0efa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lorawan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ uint8_t lowpower = 1;

void ModifyDutyCycle(McpsIndication_t *mcpsIndication){
unsigned long dutycycle = 0;
for (int i = 1; i < 3; i++) {
dutycycle = (mcpsIndication->Buffer[i]) | ( dutycycle << 8*i);
for (int i = 1; i < mcpsIndication->BufferSize; i++) {
dutycycle = (mcpsIndication->Buffer[i]) | ( dutycycle << 8*(i-1));
}
if (dutycycle!= 0) {
Serial.print("Current duty cycle is: ");
Serial.println(appTxDutyCycle);
// Changing Duty Cycle
appTxDutyCycle = dutycycle;
appTxDutyCycle = dutycycle * 1000;
Serial.print("Updated dutycycle is: ");
Serial.println(appTxDutyCycle);
} else{
Expand Down Expand Up @@ -162,9 +162,11 @@ void ModifyNumberOfSamples(McpsIndication_t *mcpsIndication){
void ModifySensorSettings(McpsIndication_t *mcpsIndication){

switch(mcpsIndication->BufferSize) {
case 2:
ModifyDutyCycle(mcpsIndication);
break;
case 3:
ModifyDutyCycle(mcpsIndication);
ModifySensorMode(mcpsIndication);
break;
case 4:
ModifyDutyCycle(mcpsIndication);
Expand Down

0 comments on commit 0db0efa

Please sign in to comment.