Git Product home page Git Product logo

bakebit's Introduction

BakeBit

English 汉语

BakeBit is an open source platform for connecting BakeBit Sensors to the NanoPi NEO/NEO2. It is based on the GrovePi.

Currently supported boards: NanoPi NEO, NanoPi NEO2, NanoPi NEO Air.

Introduction

The code work well on armbian or friendlycore (ubuntu-core) with Python 3.x

I abandon using PIP(Python Package Installer) when installing in install.sh, but not in install-compatible.sh, and take full advantage of APT with the latest release packages of distribution.

The original implementation was based on Python2, thanks to CuitGGyy for porting it to Python 3.x environment.

Installtion

FriendlyCore Xenial / Armbian Stretch / Ubuntu Core Xenial

# git clone --depth=1 https://github.com/friendlyarm/BakeBit.git
# cd BakeBit
# sudo -H ./install.sh

FriendlyCore Focal / Armbian Buster / Ubuntu Core Bionic

# git clone --depth=1 https://github.com/friendlyarm/BakeBit.git
# cd BakeBit
# sudo -H ./install-compat.sh

The demo will automatically start at the next reboot.

License

The MIT License (MIT)

BakeBit: an open source platform for connecting BakeBit Sensors to the NanoPi NEO. Copyright (C) 2016 FriendlyARM

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights 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.

bakebit's People

Contributors

ac avatar aib avatar cuitggyy avatar darrenrainey avatar erik78se avatar grassjelly avatar lawrencetg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bakebit's Issues

Question on locking strategy

Hi folks,

I'm looking at bakebit_nanohat_oled.py, and despite being very new to python, it seems to me that the lock that is attempted to make sure the draw code is not re-entrant, is broken.

`

lock.acquire()
is_drawing = drawing
page_index = pageIndex
lock.release()

if is_drawing:
    return

lock.acquire()
drawing = True
lock.release()

`

Two threads can easily reach the if statement, then both will proceed to set drawing=True. What am I missing? Cheers!

NanoPI NEO3

Do you think that with rewiring the connection will be possible to adapt the software to use NanoPI NEO 3?

NanoHat OLED: bug in bakebit_nanohat_oled.py

I have a nanopi neo-plus2 with NanoHat OLED, running the latest ubuntu image
(nanopi-neo-plus2_ubuntu-core-xenial_4.11.2_20170630.img).

I compiled the latest BakeBit_20170707 and NanoHatOLED_20170707,
and also tried compiling from the latest git. In all cases, the initial
display (page_index 0) works fine, but when I try to display page_index 1
(by pressing the middle button), bakebit_nanohat_oled.py exits on line 156
when it calls draw.text on the IP address field.

After troubleshooting, I found that this is due to the IP value having
a trailing \n. By modifying line 144 to:
cmd = "hostname -I | cut -d' ' -f1 | tr -d '\n'"
which deletes the trailing newline, everything works fine.

Nano Pi, no non-ASCII characters on OLED display

Bakebit OLED display was originally included in Friendly ARM Linux distro for NANO Pi. That is distro of Ubuntu/Debian 14.04 without X related functionality because this board does not contain GPU.
I try to print on display non-ASCII characters, included in TTF fonts provided by Bakebit. Based on included samples I wrote such code in Python2.7:

#!/usr/bin/env python
#-*- coding: utf-8 -*-  # Added for UTF-8 support
#
import bakebit_128_64_oled as oled
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import RPi.GPIO as GPIO
import time
import sys
import subprocess
import threading
import os
import socket
reload(sys)  # Added for UTF-8 support
sys.setdefaultencoding('utf-8')  # Added for UTF-8 support

global width
width=128
global height
height=64

# Reset OLED display
GPIO.setmode(GPIO.BOARD)
GPIO.setup(37, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(24, GPIO.OUT)
GPIO.output(24, True) 
time.sleep(0.1)
GPIO.output(24, False) 
time.sleep(0.1)
GPIO.output(24, True) 
time.sleep(0.2)
#
# End RESET display
#
oled.init()  #initialze SEEED OLED display
oled.setNormalDisplay()      #Set display to normal mode (i.e non-inverse mode)
oled.setHorizontalMode()

global image
image = Image.new('1', (width, height))
global draw
draw = ImageDraw.Draw(image)
global fontb24
fontb24 = ImageFont.truetype('DejaVuSansMono-Bold.ttf', 24);
global font14 
font14 = ImageFont.truetype('DejaVuSansMono.ttf', 14);
global smartFont
smartFont = ImageFont.truetype('DejaVuSansMono-Bold.ttf', 10);
global fontb14
fontb14 = ImageFont.truetype('DejaVuSansMono-Bold.ttf', 14);
global font11
font11 = ImageFont.truetype('DejaVuSansMono.ttf', 11);

draw.rectangle((0,0,width,height), outline=0, fill=0)
oled.drawImage(image)
draw.text((10, 0), "START SYSTEMU", font=fontb14, fill=255)
draw.text((23, 18), "AUTOMATYKI", font=fontb14, fill=255)
draw.text((0, 40), "SKRZYPOWA", font=fontb24, fill=255)
oled.drawImage(image)
time.sleep(5)
draw.rectangle((0,0,width,height), outline=0, fill=0)
oled.drawImage(image)

This code works OK. But if I change any letter to other, included in DejaVuSansMono but non-ASCII, random characters are display. If I print to console instead OLED, all characters are presented correctly. What I should change to get it working with full DejaVuSansMono character set?
Note, that I added all necessary commands to get python 2.7 working with UTF-8.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.