LoRaWAN and millis function


i have a little problem with my code here.
I try to implement a timeout for the softSerial library using the millis function.
The first data send is fine but after that the millis function is stuck to a value of 4364.

Here is the relevant code:

unsigned long start = millis();

  if (ss.available()) 
  Serial.print("millis: ");
} while ((millis() - start) < 200); 

if ((millis() - start) > 2500)
  Serial.println("No GPS data received: check wiring");
  gpsactive = false;

Hi @wasn I’ve seen due to LoRaWan.sleep() sleeping in the middle somewhere, although that seems less likely in your example? In any case, millis() never recovers so really it’s a bug. Use TimerGetCurrentTime() instead?

@Aaron would it be better just to alias millis() -> TimerGetCurrentTime()? Is it any more expensive to #define millis() TimerGetCurrentTime() ?

Hi @wasn

@bwooce provided the best way.:+1: we had just updated this part in the last commit, and also added ASR6502 support!

The 6502 series coming soon.

1 Like

@bwooce thank you, you helped me a lot
@Aaron great news, would love to get a asr6502 sample

6502 samples need at least 15 days… Many factories in China have not resumed full-speed operation, resulting in slow production.

Indeed the final release name for 6502 series still not defined, so just name in 6502-x :joy:

1 Like

So do I take it from this exchange that 0.0.5 has broken the millis() function? And that the official solution is to wait for the 6502 version?
Is the 6502 version pin compatible? Do we have to junk all the old modules, or revert to 0.0.4?

This bug exists in 0.0.5 or earlier code, because the timer uses the interrupt method, and the problem occurs because the interrupt is disrupted. But not every time will be disrupted, so you feel no problem with 0.0.4

You don’t need junk all old modules, just using the latest code installed via Git will be fine. ASR6502 has more GPIO and more hardware resources. We keep the pins consistent to the maximum, but cannot pin-to-pin replace. Indeed ASR6502 brings some new products.