hiveeyes / terkin-datalogger

Datalogger for MicroPython and CPython.
https://terkin.org
GNU Affero General Public License v3.0
60 stars 28 forks source link

Update build to include main files in pycom firmware base #112

Open CrispyCrafter opened 2 years ago

CrispyCrafter commented 2 years ago

This PR simply serves to automatically include boot.py and main.py in the base folder path of pycom firmware builds. This simplifies the configuration effort by no longer needing to manually include these files during device provisioning.

Obviously this has side effects where _main.py is executed prior to running the userspace version of main.py.

As such I include this PR simply as a POC in case other users of the community wish to solve a similar issue.

I don't anticipate all users to want to make use of this approach.

CrispyCrafter commented 2 years ago

Perhaps this could be included as a build flag?

amotl commented 2 years ago

Dear Bernard,

thank you very much for submitting this patch.

At first, I want to appreciate to hear back from you, because it tells us that there are actually active users of Terkin out there. The project where it was originally conceived for has ended in 2020 already and we haven't been able to put in much time in terms of continued maintenance beyond a short stunt together with @tonkenfo where we improved compatibility with Dragino and compatibility with CPython in general.

In this spirit, we would very much like to hear about where Terkin is used within other projects, specifically on MicroPython, which would be a very motivating factor for us to keep the project going, at least in maintenance mode. If you like, let us continue an eventual discussion about this topic elsewhere.

With respect to your patch, without wrapping my mind into the details and consequences too much right now, I think it would be a good idea to bring it in, specifically if that supports your workflow better. A build flag would be perfect to be able to handle both situations, feel free to make it that way to handle your case as the default one.

With kind regards, Andreas.

CrispyCrafter commented 2 years ago

Hi Andreas

Excited to finally make contact with you and the terkin community. I would very much enjoy chatting about how we are using terkin for an agricultural project in South Africa. Would you be open to a hangouts call or something along the lines at your convenience?

With respect to the PR, I'm concerned that some the proposed approach would be problematic without additional changes. The major issue here is the import of settings in main.py that would fail on the first run if no file could be found.

I've addressed this on my side with the following behaviour: _main.py

print('[main.py] INFO: Loading settings')
try:
    import settings
except ImportError:
    # Defaults to looking for user-settings.json
    print('[main.py] INFO: No python settings detected')
    settings = None
amotl commented 2 years ago

Dear Bernard,

apologies for the late reply.

Excited to finally make contact with you and the terkin community. I would very much enjoy chatting about how we are using terkin for an agricultural project in South Africa. Would you be open to a hangouts call or something along the lines at your convenience?

It is very sweet to hear back from users of Terkin. We appreciate it and look forward to a call.

With respect to the PR, I'm concerned that some the proposed approach would be problematic without additional changes. The major issue here is the import of settings in main.py that would fail on the first run if no file could be found.

I see.

I've addressed this on my side with the following behaviour [...]

That looks very reasonable. We will definitively take it into consideration within the next development cycle. Thanks again for your contribution!

With kind regards, Andreas.