config_global

package
v0.250117.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2025 License: CC0-1.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VMC = Config{
	ErrorFolder: "/home/vmc/vender-db/errors/",
	BrokenFile:  "/home/vmc/broken",
	Inventory: inventory.Inventory{
		File:           "/home/vmc/vender-db/inventory/store.file",
		XXX_Stocks:     map[string]inventory.Stock{},
		XXX_Ingredient: map[string]inventory.Ingredient{},
	},
	Money: MoneyStruct{Scale: 100, CreditMax: 100},
	Hardware: HardwareStruct{
		EvendDevices: map[string]DeviceConfig{},
		Evend: evend_config.Config{
			Cup:      evend_config.CupStruct{TimeoutSec: 60},
			Elevator: evend_config.ElevatorStruct{MoveTimeoutSec: 100},
			Espresso: evend_config.EspressoStruct{TimeoutSec: 300},
			Valve:    evend_config.ValveStruct{TemperatureHot: 86},
		},
		Display: DisplayStruct{Framebuffer: "/dev/fb0"},
		HD44780: HD44780Struct{
			Enable:        true,
			Codepage:      "windows-1251",
			PinChip:       "/dev/gpiochip0",
			Pinmap:        hd44780.PinMap{RS: "13", RW: "14", E: "110", D4: "68", D5: "71", D6: "2", D7: "21"},
			Page1:         true,
			Width:         16,
			ControlBlink:  false,
			ControlCursor: false,
			ScrollDelay:   210,
		},
		IodinPath: "",
		Input: InputStruct{
			EvendKeyboard: EvendKeyboardStruct{Enable: true},
			ServiceKey:    "",
		},
		Mdb: mdb_config.Config{
			UartDevice: "",
			UartDriver: "mega",
		},
		Mega: MegaStruct{
			Spi:      "",
			SpiSpeed: "100kHz",
			PinChip:  "/dev/gpiochip0",
			Pin:      "6",
		},
	},

	Tele: tele_config.Config{},
	UI_config: ui_config.Config{
		Front: ui_config.FrontStruct{
			MsgMenuError:                "ОШИБКА",
			MsgWait:                     "пожалуйста, подождите",
			MsgWaterTemp:                "температура: %d",
			MsgMenuCodeEmpty:            "Укажите код.",
			MsgMenuCodeInvalid:          "Неправильный код",
			MsgMenuInsufficientCreditL1: "Мало денег",
			MsgMenuInsufficientCreditL2: "дали:%s нужно:%s",
			MsgMenuNotAvailable:         "Не доступен. Выберите другой, или вернем деньги.",
			MsgCream:                    "Сливки",
			MsgSugar:                    "Caxap",
			MsgCredit:                   "Кредит: ",
			MsgInputCode:                "Код: %s",
			MsgPrice:                    "цена:%sp.",
			MsgRemotePay:                "QR ",
			MsgRemotePayRequest:         "запрос QR кода",
			MsgRemotePayReject:          "Банк послал :(",
			MsgNoNetwork:                "нет связи :(",
			ResetTimeoutSec:             300,
			PicQRPayError:               "/home/vmc/pic-qrerror",
			PicPayReject:                "/home/vmc/pic-pay-reject",
			LightShedule:                "(* 06:00-23:00)",
		},
		Service: ui_config.ServiceStruct{
			ResetTimeoutSec: 1800,
			Tests:           map[string]ui_config.TestsStruct{},
		},
	},
	Sound: sound_config.Config{
		DefaultVolume: 10,
		Folder:        "/home/vmc/vender-db/audio/",
		KeyBeep:       "bb.mp3",
		MoneyIn:       "moneyIn.mp3",
	},
	Watchdog: watchdog_config.Config{Folder: "/run/user/1000/"},
	Engine: engine_config.Config{
		Aliases: map[string]engine_config.Alias{},
		Menu: menu_config.MenuStruct{
			DefaultCream:    4,
			DefaultCreamMax: 6,
			DefaultSugar:    4,
			DefaultSugarMax: 8,
			Items:           map[string]menu_config.MenuItem{},
		},
	},
}

config wich presetted default values

Functions

func CreamMax

func CreamMax() uint8

func DefaultCream

func DefaultCream() uint8

func DefaultSugar

func DefaultSugar() uint8

func GetMenuItem

func GetMenuItem(menuCode string) (mi menu_config.MenuItem, ok bool)

func SugarMax

func SugarMax() uint8

func WriteConfigToFile

func WriteConfigToFile()

for test/ make config from ctrusture

Types

type Config

type Config struct {
	Version        string
	TeleN          tele_api.Teler
	UpgradeScript  string              `hcl:"upgrade_script,optional"`
	ScriptIfBroken string              `hcl:"script_if_broken,optional"`
	ErrorFolder    string              `hcl:"error_folder,optional"`
	BrokenFile     string              `hcl:"broken_file,optional"`
	Inventory      inventory.Inventory `hcl:"inventory,block"`
	Money          MoneyStruct         `hcl:"money,block"`
	Hardware       HardwareStruct      `hcl:"hardware,block"`
	// Persist        PersistStruct          `hcl:"persist,block"`
	Tele      tele_config.Config     `hcl:"tele,block"`
	UI_config ui_config.Config       `hcl:"ui,block"`
	Sound     sound_config.Config    `hcl:"sound,block"`
	Watchdog  watchdog_config.Config `hcl:"watchdog,block"`
	Engine    engine_config.Config   `hcl:"engine,block"`
	// Remains   hcl.Body               `hcl:",remain"`
	User ui_config.UIUser
}

func ReadConfig

func ReadConfig(log *log2.Log, fn string) *Config

конфигурация может быть перезаписана есть базывый конфиг, который может быть скорректирован записями ниже и записями во вложенных файлах. для перезаписи создается карта в которой обновляются данные из масива при инициалицации данные их карты перемещаются в рабочий масив в инвенторе есть списоки ингридиентов и складов ( бункеров) в складе указывается ссылка на ингредиент ключи ингредиента - название, для склада - код

func (*Config) KeyboardReader

func (u *Config) KeyboardReader(v ...bool) bool

func (*Config) ScaleA

func (c *Config) ScaleA(a currency.Amount) currency.Amount

func (*Config) ScaleI

func (c *Config) ScaleI(i int) currency.Amount

func (*Config) ScaleU

func (c *Config) ScaleU(u uint32) currency.Amount

func (*Config) UIState

func (u *Config) UIState(v ...uint32) uint32

type DeviceConfig

type DeviceConfig struct {
	Name     string `hcl:"name,label"`
	Required bool   `hcl:"required,optional"`
	Disabled bool   `hcl:"disabled,optional"`
}

type DisplayStruct

type DisplayStruct struct {
	Framebuffer string `hcl:"framebuffer"`
}

type EvendKeyboardStruct

type EvendKeyboardStruct struct {
	Enable bool `hcl:"enable,optional"`
}

type HD44780Struct

type HD44780Struct struct {
	Enable        bool           `hcl:"enable"`
	Codepage      string         `hcl:"codepage"`
	PinChip       string         `hcl:"pin_chip"`
	Pinmap        hd44780.PinMap `hcl:"pinmap,block"`
	Page1         bool           `hcl:"page1"`
	Width         int            `hcl:"width"`
	ControlBlink  bool           `hcl:"blink"`
	ControlCursor bool           `hcl:"cursor"`
	ScrollDelay   int            `hcl:"scroll_delay"`
}

type HardwareStruct

type HardwareStruct struct {
	EvendDevices map[string]DeviceConfig
	XXX_Devices  []DeviceConfig      `hcl:"device,block"`
	Evend        evend_config.Config `hcl:"evend,block"`
	Display      DisplayStruct       `hcl:"display,block"`
	HD44780      HD44780Struct       `hcl:"hd44780,block"`
	IodinPath    string              `hcl:"iodin_path,optional"`
	Input        InputStruct         `hcl:"input,block"`
	Mdb          mdb_config.Config   `hcl:"mdb,block"`
	Mega         MegaStruct          `hcl:"mega,block"`
}

type InputStruct

type InputStruct struct {
	EvendKeyboard EvendKeyboardStruct `hcl:"evend_keyboard,block"`
	ServiceKey    string              `hcl:"service_key,optional"`
}

type MegaStruct

type MegaStruct struct {
	LogDebug bool   `hcl:"log_debug,optional"`
	Spi      string `hcl:"spi,optional"`
	SpiSpeed string `hcl:"spi_speed,optional"`
	PinChip  string `hcl:"pin_chip,optional"`
	Pin      string `hcl:"pin,optional"`
}

type MoneyStruct

type MoneyStruct struct {
	Scale     int `hcl:"scale"`
	CreditMax int `hcl:"credit_max"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL