models

package
v0.0.0-...-3b101d6 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LoadedMovies An array of FDMovies
	LoadedMovies     [128]LoadedMovie
	LoadedMoviesSize int // todo replace with function
)

Functions

func FormatMovieTime

func FormatMovieTime() string

FormatMovieTime converts Milliseconds to position format.

func GPIOCheck

func GPIOCheck() bool

GPIOCheck checks if there is GPIO access.

func Initialize

func Initialize()

Initialize Loads the movies and configuration from file.

func LoadConfig

func LoadConfig()

LoadConfig Loads configuration from file and stores it into variable Conf

func RunEffectGPIO

func RunEffectGPIO(effect Effect, length time.Duration)

RunEffectGPIO runs the effect in GPIO, toggles the pins according to the duration.

func RunMovie

func RunMovie(movie FDMovie)

RunMovie will run the specified movie as long as there is no other movie running.

func SaveMovie

func SaveMovie(movieName string)

SaveMovie to scripts folder.

Types

type Config

type Config struct {
	ActiveHigh bool
	Effects    []Effect `toml:"effects_labels"`
}
var Conf Config

Conf A loaded config struct from file.

type Effect

type Effect struct {
	EffectName string `toml:"effect_label"`
	Pins       []int  `toml:"pins"`
}

Effect is used to give pins a user-friendly name.

type FDMovie

type FDMovie struct {
	MovieName   string                      `toml:"movie_name"`
	MovieLength int                         `toml:"movie_length"` // in minutes
	Effects     map[string]*TimestampEffect `toml:"effects"`
}

FDMovie holds all the information of a 4D movie script.

func Decode

func Decode(fileName string) (FDMovie, error)

Decode Converts a movie script file to an FDMovie struct

func GetMovie

func GetMovie(movieName string) (FDMovie, bool)

GetMovie using it's name from the loaded movies map.

type LoadedMovie

type LoadedMovie struct {
	Movie    FDMovie
	Filename string
}

LoadedMovie holds a Movie struct and the name of the file it is loaded from.

func GetLoadedMovie

func GetLoadedMovie(movieName string) (LoadedMovie, bool)

GetLoadedMovie using it's name from.

type MovieTime

type MovieTime struct {
	// contains filtered or unexported fields
}

MovieTime represents the time since the movie started.

type TimestampEffect

type TimestampEffect struct {
	EffectName   string `toml:"effect_name"`
	EffectLength int    `toml:"length_ms"` // in milliseconds
}

TimestampEffect holds a specific effect at a specific timestamp.

Jump to

Keyboard shortcuts

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