Core Electronics Forum

Corrupted main.py in loan pyTrack

Hi Graham,
I created a new folder and download ALL files.
Downloading project (main folder)…
Not safe booting, disabled in settings

Reading files from board
  Found 6 new files. Do you want to download these files into your project (C:\Users\neil\Pycom\Code\CE_pyTrack - main folder), overwriting existing files?
  (Use the confirmation box at the top of the screen)
  Downloading 6 files...
  [1/6] Reading config.py
  [2/6] Reading main.py
  [3/6] Reading boot.py
  [4/6] Reading lib/pycoproc.py
  [5/6] Reading lib/pytrack.py
  [6/6] Reading lib/L76GNSS_mapper.py
  All items overritten
  Download done, resetting board...
  OKets Jun  8 2016 00:22:57

  rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
  configsip: 0, SPIWP:0xee
  clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  mode:DIO, clock div:1
  load:0x3fff8028,len:8
  load:0x3fff8030,len:1728
  load:0x4009fa00,len:0
  load:0x4009fa00,len:14584
  entry 0x400a059c
  Traceback (most recent call last):
    File "main.py", line 67
  SyntaxError: invalid syntax
  Pycom MicroPython 1.18.1.r1 [v1.8.6-849-b0520f1] on 2018-08-29; LoPy4 with ESP32
  Type "help()" for more information.
  >>>

It is coming up with a syntax error in the main.py.
Using ATOM, when I look at lines 65 to 72, I see the following:

pycom.rgbled(RGB_LORA)

authenticav[ۈH
[�^eY�JԐW��PW�URJK�[�^eY�JԐW��PW��VJJB��eeܘK���[�X�]�][ۏSeԘK��PK]]X]][�X�][ۋ[Y[�]L
B���[He��eeܘK�\�ڛ�[�Y

N��ee��	қ�[�[�ˋ���B�X��K��bled(RGB_OFF)
    time.sleep(LED_TIMEOUT)

I have put the below code from GitHub back in and trial it on the way home.

authentication = (unhexlify(LORA_OTAA_EUI),
                  unhexlify(LORA_OTAA_KEY))

lora.join(activation=LoRa.OTAA, auth=authentication, timeout=0)

while not lora.has_joined():
    log('Joining...')
    pycom.rgbled(RGB_OFF)

Neil.

1 Like

Hi NW,

Could you please use the preformatted text when posting code? It looks like this ‘</>’

Its a bit hard to tell what’s going on with what you shared.

Try replacing that line with something like this:

# set LED to red
pycom.rgbled(0x7f0000)

Hi Stephen,
I have formatted the post.
There were quite a few lines (6) messed up and required replacing.
The black diamonds with questions marks “��” etc etc, is exactly how the code looked in VS Code Editor and ATOM.
Neil.

If I had to hazard a guess, it’s because of the config.py file that I setup for you, still has the ###### symbols for the app EUI and Key.

You’ll need to setup your own TTN Mapper app on your TTN console, along with the TTN Mapper integration. Finally, update config.py settings so that the device has access to your app.

And if the file is somehow corrupted, then you can grab a fresh copy of the project here

Hi Graham,
I copied main.py from Github and it works now.

I have driven around and added a few more points (from the Charlestown gateway) to the ttnmapper.org site.
Unfortunately, my Gateway is not displayed on this site. The ttn mapper app on my phone, also does not show my gateway. So I have no idea on the cover area of my gateway.
From my computer I can see the gateway via thethingsnetwork and see traffic.
In addition I can also see the application data for the pytrack mapper and my other Lopy4 as it talks to my gateway. So I know the gateway is operational.
It is a shame that these aren’t being included in the ttnmapper.org site data.

Neil.

Hi Neil,

I beleive you are a collaborator already for that uGateway. If so, you can update the Lat/Long in the TTN Console.

If you are not a collaborator then let me know what the last 6 digits are of the uGateway EUI, and I’ll fix that.

Hi Graham,
I believe I am already a collaborator for the Gateway.
I changed the location a month ago.
image

It used to appear on TTNMapper.org.
It like a few others (Alan’s as an example) have disappeared.

Neil.

TTN Mapper will drop data for different reasons, one example is if the Gateway moved more than 30 meters (which I suspect would be the case when editing the gateway Lat/Long from 0,0 to whatever it really is).

The TTN Mapper clean-cycle is around 30 days from memory, though it’s entirely independent of TTN and the code-base can change at any time depending on how they want to run things. Perhaps try again in a couple of weeks, give the TTN Mapper data time to adjust to the setting changes on uGateway.

Even fresh results with a properly configured Gateway can take a couple of days for TTN Mapper to “show” the gateway location.