Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3r firmware
Commits
19e7a106
Commit
19e7a106
authored
May 25, 2024
by
moon2
Browse files
Options
Downloads
Patches
Plain Diff
autostart settings: cleaner save/load mgmt
parent
16556990
No related branches found
No related tags found
1 merge request
!690
autostart settings: cleaner save/load mgmt
Pipeline
#12927
passed
May 25, 2024
Stage: check
Stage: build
Stage: deploy
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python_payload/st3m/application_settings.py
+9
-8
9 additions, 8 deletions
python_payload/st3m/application_settings.py
with
9 additions
and
8 deletions
python_payload/st3m/application_settings.py
+
9
−
8
View file @
19e7a106
...
@@ -35,12 +35,10 @@ def get_autostart():
...
@@ -35,12 +35,10 @@ def get_autostart():
try
:
try
:
with
open
(
_autostart_settings_path
,
"
r
"
)
as
f
:
with
open
(
_autostart_settings_path
,
"
r
"
)
as
f
:
_autostart_data
=
json
.
load
(
f
)
_autostart_data
=
json
.
load
(
f
)
log
.
info
(
"
Found autostart settings
"
)
except
Exception
as
e
:
except
Exception
as
e
:
_autostart_data
=
{
"
slug
"
:
None
,
"
name
"
:
None
}
log
.
info
(
"
Could not find autostart settings:
"
+
str
(
e
))
log
.
info
(
"
Could not find autostart settings:
"
+
str
(
e
))
ret
=
{}
ret
[
"
slug
"
]
=
None
ret
[
"
name
"
]
=
None
return
ret
return
_autostart_data
return
_autostart_data
...
@@ -51,12 +49,16 @@ def path_to_slug(path):
...
@@ -51,12 +49,16 @@ def path_to_slug(path):
def
set_autostart
(
path
,
name
):
def
set_autostart
(
path
,
name
):
if
not
utils
.
sd_card_plugged
():
global
_autostart_data
e
=
"
no SD card found
"
log
.
info
(
"
Could not save autostart settings:
"
+
str
(
e
))
data
=
{}
data
=
{}
data
[
"
slug
"
]
=
path_to_slug
(
path
)
data
[
"
slug
"
]
=
path_to_slug
(
path
)
data
[
"
name
"
]
=
name
data
[
"
name
"
]
=
name
if
data
==
_autostart_data
:
return
if
not
utils
.
sd_card_plugged
():
e
=
"
no SD card found
"
log
.
info
(
"
Could not save autostart settings:
"
+
str
(
e
))
return
save_fail
=
False
save_fail
=
False
if
not
os
.
path
.
exists
(
_settings_dir
):
if
not
os
.
path
.
exists
(
_settings_dir
):
try
:
try
:
...
@@ -71,7 +73,6 @@ def set_autostart(path, name):
...
@@ -71,7 +73,6 @@ def set_autostart(path, name):
log
.
warning
(
"
Could not save autostart settings:
"
+
str
(
e
))
log
.
warning
(
"
Could not save autostart settings:
"
+
str
(
e
))
save_fail
=
True
save_fail
=
True
if
not
save_fail
:
if
not
save_fail
:
global
_autostart_data
_autostart_data
=
data
_autostart_data
=
data
log
.
info
(
"
Saved autostart settings
"
)
log
.
info
(
"
Saved autostart settings
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment