friendlyarm / bakebit Goto Github PK
View Code? Open in Web Editor NEWBakeBit is an open source platform for connecting BakeBit Sensors to the NanoPi NEO/NEO2. It is based on the GrovePi.
BakeBit is an open source platform for connecting BakeBit Sensors to the NanoPi NEO/NEO2. It is based on the GrovePi.
NanoHat OLED can't change contrast by using [setBrightness], I checked all the places might change the reg 0x81 of ssd1306, but it still remained no changes.
nanopi-neo-air_sd_ubuntu-oled-xenial_4.14_armhf_20191219.img
When I open the terminal, it output IOError
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!
Bakebits that run on Atmel 328PB chips doesn't seem to be detected by running:
i2cdetect -y 0
Fixed by editing the firmware_update.sh @8f84730 script and running it:
sudo ./firmware_update.sh
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.
Do you think that with rewiring the connection will be possible to adapt the software to use NanoPI NEO 3?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.