Mac users! ‘Squinter’ utility for managing device, agent code and libraries

edited July 2014 in IDE & Tools
Mac users, here’s a little utility to try if you do your code development in a text editor and you want to make use of library code files that are separate from your agent and device source files.

You can add libraries to your source code by adding a line like this:

#import </Users/[username]/Documents/ht16k33.class.nut/>

and the utility, Squinter, will run through the source (agent first, then device), find the #import, load up the library code and paste it in ready for you to copy the ‘compiled’ source into the Electric Imp IDE. Your source files remain untouched, for ease of editing.

image

Squirrel treats # as a comment marker, so the above line will not affect your running Squirrel code should you paste ‘uncompiled’ code into the IDE.

Squinter lets you save agent and device source code combos as projects for easy opening next time, and it lets you open your source and library files in your favourite text editor or whatever app you have set to handle .nut files.

There are some limits: agent and device source files need to be in the format: ‘someproject.agent.nut’ and ‘someproject.device.nut’. Libraries should be named 'somelibrary.class.nut’ or 'somelibrary.library.nut’. You can add one or both of these files to an existing project, or use a pair of them to create a new project.

You will need to allow your Mac to open ‘apps downloaded from anywhere’ (in the Security & Privacy prefs), and you’ll need Mac OS X 10.9.

As always with free software (pre-release code in particular), you use Squinter entirely at your own risk. There will be bugs; please do post notifications of them when you get bitten by one.

Note: the file is a .gz file containing a .zip archive. If it opens as a plain document, just double-click the extracted file to reveal Squinter.
gz
gz
Squinter.zip.gz
2M
squinter.jpg
768 x 469 - 128K
«1

Comments

  • is there any possibility you could show us (video, google hangout, or tutorial) to show us how you are doing development with the imp? It would really help us. Thank you
  • Of course, @snowbiker100, but first what aspect of 'doing development with the imp' are you interested in? That covers a lot of possibilities - can we narrow it down a bit? There may already be some documentation which meets your needs, for instance.
  • I did read the interface documentation. I created several models, but I continuously overwrite my code. I have resorted to copying my code out and pasting it into a separate editor. I find this to be extremely unproductive for me. You obviously have a much better way of dealing with these programs.

    I would love to have a Google Hangout where you show us how you are doing your development. Even better would be a multipart series so we can get experience building a real application with Electric Imp tools and IDE. Do you think that is possible?

    The application I'm trying to build is a smart home with the electric imp at the center and other sensors around the house sending messages. I do a lot of work with Arduino and I want to interface the NRF. There seems to be a great example here (if I can get it working the way I need as a messaging receiver):
    http://arduino-for-beginners.blogspot.com/2013/06/electric-imp-arduino-nrf24l01-fully.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed:+ArduinoForBeginners+(Arduino+for+Beginners)

    I also want to integrate with:
    https://www.twilio.com/ and
    https://xively.com (the idea is to abstract the messages from the behaviors)

    The user experience I'm after is a series of messages with varying levels of warnings. If the warning message critical enough I will get a text or cell phone call from twilio. below are some simple messages I intend to send and receive using the electric imp as the hub:

    The Talking House:
    1. there is water in the basement in section X
    2. weather calls for temperatures below 50° and window number X is open
    3. plants in section X need water current moisture level at Y
    4. unexpected movement detected in section X after threshold hours
    5. garage door number X is open after threshold hours
    6. house door open or unlocked after threshold hours
    7. temperatures in section X below/above threshold
    8. smoke/fire/ carbon dioxide detected in section X
    9. television/radio/item X in section Y left on after threshold hours
    10. and many more

    Of course all of these messages would be associated with some code managed in an AWS database so I can easily add and modify them.

    thank you @smittytone,

    snow biker






  • @snowbiker100 - I've been kind of working on an Electric Imp video tutorial series, but I'm too much of a perfectionist and video editing takes a long time.

    Maybe instead I'll do some live coding Google Hangouts where I go through what I'm working on, and let people ask questions, etc

    Would you (and other people) be into such a thing?
  • edited October 2014
    @beardedinventor I would be happy to help edit the videos if you want to to the tutorial series. I know a number of developers that would love to use the Imp, but need to move beyond the "Hello World" to be productive. You are far ahead and it would be very helpful.
    ---
    Absolutely! I would really appreciate that type of effort. I can see many people making some great projects with the Imp, but the fundamentals are critical to be productive. Thank you. Please let me know when you think we can start.
  • One quick point, @snowbiker100: if you overwrite your code, you can always get it back using the ‘Build xxx’ menu. This lets you access previous builds, any of which can be copied into a new build. I find this handy for experimenting: change code, test, reject, go back to the build before the change.

    Screen Shot 2014-10-13 at 10.50.32.png
    469 x 384 - 64K
  • Thanks @smittytone that is a good tip. I am not sure I understand the relationship between models and the link to devices. I seems to have multiple models linked to the same device. I am also challenged by the UI as a sublime user. I would really love to be more productive with the interface.
  • edited October 2014
    Each device can be associated with only one model, but each model can have multiple devices assigned to it. This is why devices are listed by model, not the other way round.

    Case in point: I have one digital clock model, but four devices (two in the office, two at home) running that model. So the Model Navgator (the IDE's left-hand column) lists those four devices under the single banner of the model name.

    You can write the agent and device code - the software units that together comprise a model - anywhere you like. I usually write in TextWrangler and then copy and paste into the IDE. The problem is, I then tweak in the IDE and the two copies quickly get out of sync! But that's just bad discipline on my part.

    Squinter is handy because it lets me keep class files separate from the main body of the agent code and the device code. We're working on an API which will allow other apps to communicate with the IDE server, in turn allowing agent and device code to be uploaded rather than pasted in. There's no fixed release date for this yet, but it will allow apps like Squinter to become the focus of development so the IDE can be left behind.

    I've attached the latest version which, more helpfully allows all the files associated with a project to be opened at once in the text editor Mac OS X has associated with text files.
    gz
    gz
    squinter.zip.gz
    2M
  • @smittytone can you do a quick screen cast to show us how you use Squinter?
    Would be very much appreciated. Thank you
  • @smittytone I love the idea of the API I think that will really open up the Imp to many more developers.
  • edited October 2014
    Latest Version (0.5.02)

    image
    gz
    gz
    Squinter.zip.gz
    2M
    ss.png
    921 x 639 - 104K
  • edited August 2015
    @smittytone - Is Squinter Open Source? I've found https://github.com/smittytone/BuildAPIAccess but I'd like to draw some inspiration from some of Squinter's other features if the source code is available.

    Also, I was able to download and run Squinter - but curiously I had to do it with 7-Zip on my Windows VM to get it to extract correctly on my mac...
  • I’m not planning to open-source Squinter just yet, @deldrid1, but this may change when it's nearer to completion.

    Not sure why the gz-ing isn't working right, but on a Mac, double-click the .gz file. Then add .zip to the resulting file, it will then unzip correctly. Possibly a cock-up on my part.
  • Updated version attached.
    zip
    zip
    Squinter.zip
    2M
  • Massively updated new version. Supports Electric Imp libraries as well as your own local ones; does log streaming; more UI customisation; greater stability; support for latest version of the Build API.
    zip
    zip
    Squinter_0-7-67.zip
    2M
  • @smittytone - glad to see this is continuing to progress!

    Any thoughts on creating an Atom plugin instead of creating your own text editor? The team over at Particle.io did exactly that, see https://www.particle.io/dev.

    With the build API this should be pretty straight forward, I've just not had the time to devote to it...I did create a repo - https://github.com/deldrid1/atom-imp-tools
  • Folks, there's a new version of Squinter available:

    https://www.dropbox.com/s/aqjq1w3o1uomlua/Squinter_1_0_100.zip?dl=0

    Mostly bug fixes, and I've reverted to official terminology: 'models' not 'apps'.

    Maybe now I can get round to doing propers documentation etc.
  • And another one:

    https://www.dropbox.com/s/rylsjzsjjwkglnc/Squinter_1_0_102.zip?dl=0

    Minor code changes; completely revised Help system - see the appropriate menu.
  • New version (b106): https://www.dropbox.com/s/g0d35upan22rdrb/Squinter_1_0_106.zip?dl=0

    Squinter now handles multi-line comments in code, and better supports the importing of non-library files. Libraries and other files can be imported using #import and/or #include (use which you prefer).

    Squinter also supports the #define directive, eg.
    #define __MULTIFILE_CONSTANT__ = 45.6

    Because of the inclusion of any file (ie. not just libraries/classes) you can, for example, have a file 'constants.h' which lists your #defines and then #include or #import 'constants.h' into your agent and/or device source code files.

    So if your device code contains
    #include "constants.h"

    local myVar = __MULTIFILE_CONSTANT__;
    it will compile to
    local myVar = 45.6;
    Help should be working properly now too.
  • Hot on the heels (to squash a couple of irritating bugs that slipped through):

    https://www.dropbox.com/s/qxovmnd7am2snxg/Squinter_1_0_107.zip?dl=0
  • Further work yields:

    https://www.dropbox.com/s/wj8zafc094rqzs1/Squinter_1_0_110.zip?dl=0

    Now with Sparkle support for in-app updates (and some bugs dealt with).
  • Now available via Sparkle: Squinter 1.0.111 (if you have an older version than 1.0.110, please update using the link in the comment above, and then select 'Check for Updates...' in the Squinter menu).
  • edited June 2016
    Now available via Sparkle: Squinter 1.0.112 (if you have an older version than 1.0.110, please update using this link, and then select 'Check for Updates...' in the Squinter menu).

    Improvements/Additions


    • You can now stream logs from multiple devices simultaneously

    • Logging devices are indicated in the 'Current Device' pop up and the device lists under each model in the 'Models -> Current Models' menu

    • The 'Devices' menu now has an 'Open Agent URL' command to call up the agent URL in your browser

    • Tooltips added to the toolbar items

    • Added 'Refresh model list' toolbar item

    • Updated BuildAPIAccess to 2.0.0

    Bug Fixes


    • Fixed an incorrect 'Project Info' toolbar icon

  • Now available via Sparkle: Squinter 1.0.113 (if you have an older version than 1.0.110, please update using this link, and then select 'Check for Updates...' in the Squinter menu).

    Improvements/Additions
    • Colouring of multiple device log streams to aid readability

    • Agent URLs in the log (from 'Get Device Info') are clickable links

    • #imported files (ie. non-libraries) now saved in project

    • User is notified when local files and libraries are removed from source code
    Bug Fixes
    • Displaying long code listings in the log doesn't invoke the beach ball

    • Fixed an issue in which #imported files were not being correctly listed

    • Fixed an issue in which a project was closed with unsaved changes, the user asked to save the changes first, but they were not being saved

    • Fixed an issue in which a project was closed with unsaved changes, but was not actually closing
  • edited September 2016
    Beginner's mistake, maybe helpful for others. The import statement is of course not
    #import </Users/[username]/Documents/ht16k33.class.nut/>
    as initially stated, but
    #import "/Users/[username]/Documents/ht16k33.class.nut"
    At least in 1.0.115
  • edited September 2016
    Version 1.0.116 is out, if you'd care to click on 'Check for Updates...'
  • edited November 2016
    Hi Smitty,

    Having trouble importing files from a sub-directory i.e. #import "utilities/PushID.class.nut" or
    #import "utilities\PushID.class.nut"

    How do I need to be specifying this?

    I notice if I set my working directory to match my project directory it's OK, but this isn't manageable because I have various Git projects in different directories so need a more modular solution.
  • Interesting, @Scribe. Thanks for the find: there'll be a fix for this in 1.0.117, out shortly.
  • And 1.0.117 is out now!
Sign In or Register to comment.