enhanceSettings

This commit is contained in:
SpudGunMan
2024-07-24 22:32:58 -07:00
parent 0686d21427
commit e1e6ec6224
2 changed files with 28 additions and 12 deletions
+15
View File
@@ -23,24 +23,39 @@ port = /dev/ttyUSB0
# mac = 00:11:22:33:44:55
[general]
# if False will respond on all channels but the default channel
respond_by_dm_only = True
# defaultChannel is the meshtastic default public channel
defaultChannel = 0
# motd is reset to this value on boot
motd = Thanks for using MeshBOT! Have a good day!
welcome_message = MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd
# enable or disable the Joke module
DadJokes = True
# StoreForward Enabled and Limits
StoreForward = True
StoreLimit = 3
# 24 hour clock
zuluTime = True
# wait time for URL requests
URL_TIMEOUT = 10
[bbs]
enabled = True
# list of banned nodes numbers ex: [2813308004, 4258675309]
bbs_ban_list = []
# list of admin nodes numbers ex: [2813308004, 4258675309]
bbs_admin_list = []
# location module
[location]
enabled = True
lat = 48.50
lon = -123.0
# weather forecast days, the first two rows are today and tonight
DAYS_OF_WEATHER = 4
# number of weather alerts to display
ALERT_COUNT = 2
# solar module
[solar]
+13 -12
View File
@@ -1,20 +1,16 @@
import configparser
# Global variables
URL_TIMEOUT = 10 # wait time for URL requests
DAYS_OF_WEATHER = 4 # weather forecast days, the first two rows are today and tonight
ALERT_COUNT = 2 # number of weather alerts to display
STORE_LIMIT = 3 # number of messages to store for Store and Forward
bbs_ban_list = [] # list of banned nodes numbers ex: [2813308004, 4258675309]
bbs_admin_list = [] # list of admin nodes numbers ex: [2813308004, 4258675309]
msg_history = [] # message history for the store and forward feature
# messages
NO_DATA_NOGPS = "No location data: does your device have GPS?"
ERROR_FETCHING_DATA = "error fetching data"
WELCOME_MSG = 'MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd'
MOTD = 'Thanks for using MeshBOT! Have a good day!'
# setup the global variables
msg_history = [] # message history for the store and forward feature
bbs_ban_list = [] # list of banned users
bbs_admin_list = [] # list of admin users
# Read the config file, if it does not exist, create basic config file
config = configparser.ConfigParser()
config_file = "config.ini"
@@ -29,7 +25,7 @@ if config.sections() == []:
config['interface'] = {'type': 'serial', 'port': "/dev/ttyACM0", 'hostname': '', 'mac': ''}
config['general'] = {'respond_by_dm_only': 'True', 'defaultChannel': '0', 'motd': MOTD,
'welcome_message': WELCOME_MSG,
'DadJokes': 'True', 'StoreForward': 'True', 'StoreLimit': STORE_LIMIT, 'zuluTime': 'False'}
'DadJokes': 'True', 'StoreForward': 'True', 'StoreLimit': '3', 'zuluTime': 'False'}
config['bbs'] = {'enabled': 'True', 'bbsdb': 'bbsdb.pkl'}
config['location'] = {'enabled': 'True','lat': '48.50', 'lon': '-123.0'}
config['solar'] = {'enabled': 'True'}
@@ -53,11 +49,11 @@ else:
interface2_enabled = False
# variables
storeFlimit = config['general'].getint('StoreLimit', STORE_LIMIT)
storeFlimit = config['general'].getint('StoreLimit', 3) # default 3 messages for S&F
useDMForResponse = config['general'].getboolean('respond_by_dm_only', True)
publicChannel = config['general'].getint('defaultChannel', 0) # the meshtastic public channel
location_enabled = config['location'].getboolean('enabled', False)
latitudeValue = config['location'].getfloat('lat', 48.50)
latitudeValue = config['location'].getfloat('lat', 48.50)
longitudeValue = config['location'].getfloat('lon', -123.0)
zuluTime = config['general'].getboolean('zuluTime', False)
welcome_message = config['general'].get('welcome_message', WELCOME_MSG)
@@ -67,3 +63,8 @@ bbsdb = config['bbs'].get('bbsdb', 'bbsdb.pkl')
dad_jokes_enabled = config['general'].getboolean('DadJokes', False)
store_forward_enabled = config['general'].getboolean('StoreForward', False)
config['general'].get('motd', MOTD)
URL_TIMEOUT = config['general'].getint('URL_TIMEOUT', 10) # default 10 seconds
DAYS_OF_WEATHER = config['general'].getint('DAYS_OF_WEATHER', 4) # default days of weather
ALERT_COUNT = config['general'].getint('ALERT_COUNT', 2) # default 2 alerts
bbs_ban_list = config['bbs'].get('ban_list', '').split(',')
bbs_admin_list = config['bbs'].get('admin_list', '').split(',')