ESP32-LMIC-DeepSleep-example icon indicating copy to clipboard operation
ESP32-LMIC-DeepSleep-example copied to clipboard

US Version?

Open gmanrc opened this issue 4 years ago • 9 comments

Hi,

I was wondering if there are any developments for US applications?

Kind regards,

gmanrc avatar Sep 23 '21 20:09 gmanrc

Since I don't have a US version of a gateway and node, I can't customize the code either (Since I can't test it). Therefore I will not create a US variant.

But if someone wants to make a PR, feel free!

JackGruber avatar Sep 25 '21 07:09 JackGruber

I have a US Version node and US version gateway. I'm not so experienced at developing code, but happy to help if can tell me what to adapt for US version.

gmanrc avatar Sep 27 '21 15:09 gmanrc

I am interested in a US Version myself. The code as written fails to compile for me as there is error that I believe is due to the EU configuration.

// EU Like Bands
#if defined(CFG_LMIC_EU_like) 
Serial.println(F("Reset CFG_LMIC_EU_like band avail"));
for (int i = 0; i < MAX_BANDS; i++)

Gives error: 'MAX_BANDS' was not declared in this scope

Although commenting all the code referring to 'MAX_BANDS' got it to work for me.

mdede439 avatar Nov 08 '21 05:11 mdede439

When you use a US band, the CFG_LMIC_EU_like should not be set and therefore this codeblock should also not be compiled.

JackGruber avatar Nov 08 '21 17:11 JackGruber

Makes sense but it doesn't seem to work that way. I select #define CFG_us915 1 in the project_config.h file and I get the compile errors. However if I select #define CFG_eu868, the file compiles without error. So it looks like the eu spec gets recognized as "EU_like" however the US spec does not get recognized as NOT "EU_like". Unless I have something that is not as up to date as it should I think I can live with just commenting the code out. Unless you have other ideas?

Appreciate your response and hard work creating this code in the first place!!!!

mdede439 avatar Nov 08 '21 18:11 mdede439

At the moment I have no dev enviroment. Could you replace the #if defined(CFG_LMIC_EU_like) with #if CFG_LMIC_EU_like and try it again or with #if defined(CFG_eu868)

JackGruber avatar Nov 08 '21 18:11 JackGruber

Both "#if CFG_LMIC_EU_like" and "#if defined(CFG_eu868)" work. The code compiles without error and functions correctly as far as I can tell. My TTGO board is able to join TTN V3 and send data and then go to sleep and upon waking send more data without the usual Join preceding the data transmission.

Thanks!!

mdede439 avatar Nov 08 '21 19:11 mdede439

I went back in the code and discovered I had to comment out another section because it referrs to the MAX_BANDS variable that only the EU band uses. If I re-introduce that part to the code it fails to compile. It is only a series of Serial.print statements.

Serial.println(F("Band \tavail \t\tavail_sec\tlastchnl \ttxcap"));
for (u1_t bi = 0; bi < MAX_BANDS; bi++)
{
    Serial.print(bi);
    Serial.print("\t");
    Serial.print(lmic_check.bands[bi].avail);
    Serial.print("\t\t");
    Serial.print(osticks2ms(lmic_check.bands[bi].avail) / 1000);
    Serial.print("\t\t");
    Serial.print(lmic_check.bands[bi].lastchnl);
    Serial.print("\t\t");
    Serial.println(lmic_check.bands[bi].txcap);
}
Serial.println("");
Serial.println("");

mdede439 avatar Nov 08 '21 22:11 mdede439

You have to put this code alo into a #if CFG_LMIC_EU_like block.

JackGruber avatar Nov 09 '21 05:11 JackGruber