Exemplo n.º 1
0
def main():
    oled.init()  #initialze SEEED OLED display
    oled.setNormalDisplay()  #Set display to normal mode (i.e non-inverse mode)
    oled.setHorizontalMode()

    oled.drawImage(Image.open('friendllyelec.png').convert('1'))
    time.sleep(1)

    signal.signal(signal.SIGUSR1, receive_signal)
    signal.signal(signal.SIGUSR2, receive_signal)
    signal.signal(signal.SIGALRM, receive_signal)

    currentView = VnstatView()

    while True:
        try:
            try:
                event = eventQueue.get(True, screenUpdateTime)
                currentView = currentView.processEvent(event)
            except Queue.Empty:
                pass

            # Draw a black filled box to clear the image
            draw.rectangle((0, 0, width, height), outline=0, fill=0)
            currentView.render(draw)
            oled.drawImage(image)
        except KeyboardInterrupt:
            break
        except IOError as e:
            print("Error:", e)

    # Cleanup before exit
    oled.clearDisplay()
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

import bakebit_128_64_oled as oled
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

oled.init()  #initialze SEEED OLED display

oled.clearDisplay(
)  #clear the screen and set start position to top left corner
oled.setNormalDisplay()  #Set display to normal mode (i.e non-inverse mode)
oled.setHorizontalMode()

image = Image.open('friendllyelec.png').convert('1')
oled.drawImage(image)
Exemplo n.º 3
0
from modules.pages.pagedtable import PagedTable
from modules.pages.page import Page

from modules.network import *
from modules.utils import *
from modules.modes import *
from modules.system import *

from modules.apps import *

####################################
# Initialize the SEED OLED display
####################################
oled.init()
# Set display to normal mode (i.e non-inverse mode)
oled.setNormalDisplay()
oled.setHorizontalMode()

#######################################
# Initialize various global variables
#######################################
g_vars = {

    ##################################################
    # Shared status signals (may be changed anywhere)
    ##################################################

    # This variable is shared between activities and is set to True if a
    # drawing action in already if progress (e.g. by another activity). An activity
    # happens during each cycle of the main while loop or when a button is pressed
    # (This does not appear to be threading or process spawning)