Skip to content

Commit

Permalink
Remove RoverIMG() dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
EinEinfach committed Nov 1, 2023
1 parent 55f1968 commit 28598db
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CaSSAndRA/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

#Version:0.96.3 Some fixes in charts.py if state_filtered is empty
#Version:0.96.4 Remove RoverIMG dataclass and include it to AppCfg dataclass
# package imports
import os
import sys
Expand Down
2 changes: 1 addition & 1 deletion CaSSAndRA/src/backend/data/appdata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import logging
logger = logging.getLogger(__name__)

version = '0.96.3'
version = '0.96.4'
10 changes: 2 additions & 8 deletions CaSSAndRA/src/backend/data/cfgdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,14 @@ def save_commcfg(self) -> None:

#appcfg class
@dataclass
class RoverIMG:
img0deg: Image = None

def load_rover_pictures(self, absolute_path: str):
self.img0deg = Image.open(absolute_path+'rover0grad.png')
@dataclass
class AppCfg:
datamaxage: int = 30
time_to_offline: int = 60
voltage_0: float = 22
voltage_100: float = 28
current_thd_charge: float = -0.03
rover_picture: str = 'default/'
rover_pictures: RoverIMG = RoverIMG()
rover_pictures: Image = None
obstacles_amount: int = 0
file_path: str = ''

Expand All @@ -148,7 +142,7 @@ def read_appcfg(self) -> None:
self.voltage_100 = appcfg_from_file['voltage_to_soc'][1]['V']
self.current_thd_charge = appcfg_from_file['current_thd_charge']
self.rover_picture = appcfg_from_file['rover_picture']
self.rover_pictures.load_rover_pictures(os.path.dirname(__file__).replace('/backend/data', '/assets/icons/'+self.rover_picture))
self.rover_pictures = Image.open(os.path.dirname(__file__).replace('/backend/data', '/assets/icons/'+self.rover_picture)+'rover0grad.png')
self.obstacles_amount = appcfg_from_file['obstacles_amount']
except Exception as e:
logger.error('Could not read appcfg.json. Data are invalid. Go with standard values')
Expand Down
2 changes: 1 addition & 1 deletion CaSSAndRA/src/backend/data/roverdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def change_speed(self, choise: str(), speeddiff: float) -> None:
self.gotospeed_setpoint = min(1, new_setpoint)

def set_rover_image(self) -> None:
return Image.Image.rotate(appcfg.rover_pictures.img0deg, self.direction, resample=Image.BICUBIC)
return Image.Image.rotate(appcfg.rover_pictures, self.direction, resample=Image.BICUBIC)

def check_mapupload(self) -> None:
if self.map_upload_started and self.map_crc == self.map_old_crc:
Expand Down

0 comments on commit 28598db

Please sign in to comment.